0

My default controller is index.php so when i call from it my view its working fine... then i call the following views but it prints text instead of html

<?=$this->load->view('header'); ?>
<?=$this->load->view("index/left_side"); ?>
<?=$this->load->view("index/right_side"); ?>
<?=$this->load->view('footer'); ?>

i am using WAMP on Windows 7.

Does it have anything to do that i use <?= instead of <?php ?

SOLUTION: i enabled short tags and asp tags and its working now.

1
  • Make sure your file is saved as .php and not .txt.php Commented Feb 14, 2012 at 14:56

2 Answers 2

3

By default asp_tags and short_open_tag are off on WAMP so try <?php not <?

Sign up to request clarification or add additional context in comments.

3 Comments

so its safer to use <?php instead of <?
That would be short_open_tag.
Yes, short_open_tag it's the corect php.ini config for this one, i seen the = and posted asp_tags. Editting
1

Not sure if you are referring to the content-type of the reponse or just the output of the function.

But you are using the Load Function wrong. Checkout - The User Guide - The load->view function output the content already. So you would actually use <?php $this->load->view('header'); ?> or use the parameters to make it produce a string.

For example :

<?php 
    $content =  $this->load->view('header', '', TRUE);
    echo $content;
?>

And about the tags. As far as I know it only depends on if your server is configured to support the short tag. (I could be wrong about this).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.