EllisLab text mark
Advanced Search
     
I am getting <? for all instances of where I expect the PHP to be. 
Posted: 15 November 2012 02:24 PM   [ Ignore ]
Joined: 2012-11-15
2 posts

Hi All.

I recently took an already existing codeigniter site off my hosting provider to my localhost. I have correctly changed the database.php file (or at least I don’t have any reported problems). I checked the Logs folder but there is only an index.html file there.

For instance the <title> I am getting from the page source looks like this

<title><?$meta_title?></title

It should of course render to

<title>A nice Page </title

Even built in items such as

<?base_url() ?> 
are rendering as
<?base_url() ?>resources/css/reset.css 

:-(

I downloaded a fresh copy of codeigniter from the codeigniter site, and codeigniter works as expected, so something is amiss with the existing site I downloaded. Dose anyone have any ideas what causes the <? to render instead of the intended php code ?

Thanks a mill,

Daragh

 
Posted: 15 November 2012 02:58 PM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Avatar
Joined: 2011-04-13
256 posts

Check your application/config/config.php file.

$config[‘global_xss_filtering’] = TRUE;

If it’s set to TRUE, that is the behavior. Try setting it to FALSE.

 Signature 

Expert Web Development Backed by LIFETIME Guarantee
CI-Foundation v1
InfinityTracker - Project Management

 
Posted: 15 November 2012 04:02 PM   [ Ignore ]   [ # 2 ]   [ Rating: 0 ]
Joined: 2011-02-23
882 posts

It is most likely a configuration issue of your webserver. Some configurations allow using

<?$meta_title ?> 

to automatically echo the succeeding variable, some environments require you to write

<?php echo $meta_title?> 

Plus: Is your fileextension .php or anything else? If it’s not .php it will not be parsed by the PHP interpreter thus the command <?= is unknown. However, you should not be having any other fileextension but .php when working with CI (except .htaccess)

 Signature 

ignited Community Framework (WiP)  |  Read the User’s Guide. It won’t bite.

STOP! Before posting your questions, remember the WWW Golden rule:
What did you try? What did you get? What did you expect to get?

CI example .htaccess

 
Posted: 15 November 2012 04:05 PM   [ Ignore ]   [ # 3 ]   [ Rating: 0 ]
Avatar
Joined: 2009-02-19
3801 posts

There is a config setting for that regardless of whether the server supports php short tags (<? instead of <?php)

$config['rewrite_short_tags'TRUE

 

 Signature 
 
Posted: 16 November 2012 07:11 AM   [ Ignore ]   [ # 4 ]   [ Rating: 0 ]
Joined: 2012-11-15
2 posts

Hi All,

It was the

$config['rewrite_short_tags'TRUE

that was set as false. I changed it to true and it worked perfectly !. Thank you very much for all the help.