CodeIgniter Forums
I am getting <? for all instances of where I expect the PHP to be. - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter Archived (from EllisLab) (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: I am getting <? for all instances of where I expect the PHP to be. (/thread-55899.html)



I am getting <? for all instances of where I expect the PHP to be. - El Forum - 11-15-2012

[eluser]Unknown[/eluser]
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

Code:
<title><?= $meta_title; ?></title>

It should of course render to
Code:
<title>A nice Page </title>

Even built in items such as
Code:
<?= base_url() ?>
are rendering as
Code:
<?= 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


I am getting <? for all instances of where I expect the PHP to be. - El Forum - 11-15-2012

[eluser]Mirge[/eluser]
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.


I am getting <? for all instances of where I expect the PHP to be. - El Forum - 11-15-2012

[eluser]PhilTem[/eluser]
It is most likely a configuration issue of your webserver. Some configurations allow using
Code:
<?= $meta_title ?>

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

Code:
<?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)


I am getting <? for all instances of where I expect the PHP to be. - El Forum - 11-15-2012

[eluser]CroNiX[/eluser]
There is a config setting for that regardless of whether the server supports php short tags (<? instead of <?php)
Code:
$config['rewrite_short_tags'] = TRUE;



I am getting <? for all instances of where I expect the PHP to be. - El Forum - 11-16-2012

[eluser]Unknown[/eluser]
Hi All,

It was the
Code:
$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.