CodeIgniter Forums
starting... <?= dont work - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: starting... <?= dont work (/showthread.php?tid=5857)

Pages: 1 2


starting... <?= dont work - El Forum - 02-06-2008

[eluser]Peter74[/eluser]
hi, well anybody can tell me why the tag <?= dont work for me?
i have php 5 version
txs

<li>&lt;?= anchor('application', 'The Application');?&gt;</li>

that is the look when apply "see code" in firefox


starting... &lt;?= dont work - El Forum - 02-06-2008

[eluser]mariowarner[/eluser]
have you tried setting the $config['rewrite_short_tags'] at the config.php to TRUE?


starting... &lt;?= dont work - El Forum - 02-06-2008

[eluser]Peter74[/eluser]
in system/application/config/config.php i dont see $config[’rewrite_short_tags’].
I must add that line?

:S


starting... &lt;?= dont work - El Forum - 02-06-2008

[eluser]Tom Glover[/eluser]
[quote author="Peter74" date="1202336853"]in system/application/config/config.php i dont see $config[’rewrite_short_tags’].
I must add that line?

:S[/quote]

Yes but the line should be at the bottom of the config file. If it is not there add it.

This tell CI to rewrite the short php tags before parsing. also if this does not work report it as a bug, but before you report it check that your version of php can support short tags without the use of CI's conversion.


starting... &lt;?= dont work - El Forum - 02-06-2008

[eluser]Peter74[/eluser]
Hi, i resolv this issue looking for "short tags", and i find in http://cl2.php.net/ini.core the answer
and change short_open_tag = Off to short_open_tag = On in the php.ini file.

i find many comments kind "dont do that, use long tags" i dont know why
Txs both any way


starting... &lt;?= dont work - El Forum - 02-06-2008

[eluser]Nanodeath[/eluser]
The reason you find comments like that is that all servers support &lt;?php tags, but only a subset of servers support &lt;? tags. However, since CodeIgniter has rewrite_short_tags, this isn't as much of an issue (unless you're debugging, of course).


starting... &lt;?= dont work - El Forum - 02-06-2008

[eluser]Peter74[/eluser]
humm, i see... so if i write my app with short tags, and later take some hosting, with only &lt;?php tag support my app dont work .. big problem

so, where i can find or add, that function, just adding that line in the config.php file?
or i have to add some library too ( i dont know, i thik "something" have to do the work xD )

pd: very txs for ur feedback Smile


starting... &lt;?= dont work - El Forum - 02-06-2008

[eluser]Nanodeath[/eluser]
Just doing what mariowarner suggested should do the trick, though I believe errors become somehow more cryptic (I believe -- I haven't used it personally).


starting... &lt;?= dont work - El Forum - 02-06-2008

[eluser]mariowarner[/eluser]
[quote author="Peter74" date="1202336853"]in system/application/config/config.php i dont see $config[’rewrite_short_tags’].
I must add that line?:S[/quote]

hi peter,

it's found at the bottom of config.php right before the php closing tag (? >). the CI i am using when i started is version 1.5.4 (i only started using CI 9 days ago) and if you're using the same, you should be able to find the line. below is how it looks like on my config.php

Code:
/*
|--------------------------------------------------------------------------
| Rewrite PHP Short Tags
|--------------------------------------------------------------------------
|
| If your PHP installation does not have short tag support enabled CI
| can rewrite the tags on-the-fly, enabling you to utilize that syntax
| in your view files.  Options are TRUE or FALSE (boolean)
|
*/

$config['rewrite_short_tags'] = TRUE; // this is set to FALSE by default.


it's ok to edit the php.ini file but if you're gonna run your codes from a different server where you don't have control over the php.ini, it's easier to just modify the value of that line (or add that line if it's missing).

Smile


starting... &lt;?= dont work - El Forum - 02-06-2008

[eluser]mariowarner[/eluser]
ohh, and it doesn't require you to add any libraries. it's there by default (or it should be there by default). i just upgraded to 1.6 and it's still working fine for me. Smile i had a harder time setting up the .htaccess to hide the "index.php" line on the URL.