Welcome Guest, Not a member yet? Register   Sign In
<?=$title?> and <?php echo $title; ?>.
#1

[eluser]Jeeremie[/eluser]
Hi!

In the video tutorial and forum, everyone write a PHP short tag - e.g. <?=$title?> - instead of usual tag <?php echo $title; ?>.

But when I try the short tag, nothing is being displayed. Do I have to configure something first?

I am on WindowsXP and use EasyPHP 2.0.
#2

[eluser]xwero[/eluser]
In the php ini file you need to allow short tags but i never use it. If you want to limit the amount of php code in the view files you best use a template parser, CIs or a more powerful one like smarty.
#3

[eluser]Jeeremie[/eluser]
Ok, thanks. I will think about it.
#4

[eluser]Unknown[/eluser]
This is the first time I have looked at code igniter and the screen casts were the first port of call for me.

The use of the short tag (and the author's recommendation of their use) forced me to come into the forums to find discussion on it.

After developing PHP for 3 years, I have read and been told over and over again that the use of PHP's short tags is simply bad practise for the obvious reason of portability, and the conflicts that can occur with XML open tags.

I wasn't aware that it was still accepted by some developers. Should this be clearly highlighted somewhere? Or is it assumed that the bulk of Code Igniter's users are aware of it?

Aaron
#5

[eluser]Derek Jones[/eluser]
If you set the 'rewrite_short_tags' config variable to TRUE, then you will not have to worry about whether or not the server you are on supports short tags. Though that would affect other tags that use the <? convention, as Aaron points out.




Theme © iAndrew 2016 - Forum software by © MyBB