CodeIgniter Forums

Full Version: I am getting <? for all instances of where I expect the PHP to be.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[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

El Forum

[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.

El Forum

[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)

El Forum

[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;

El Forum

[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.