Well first off, the grammar of PHP is unambiguous so you should be
able to use a regular expression to convert all the short tags. Here's
a linux command to replace one string with another in all text files
in a folder

grep -rl ‘OLD’ . | xargs sed -i -e ’s/OLD/NEW/’

But you need to modify this to look not only for the opening tag, but
for the matching closing tag to make two replacements:
<?= and ;?> replace with <?php echo( and );?>

So email me if you chose this route, get stuck but really really need
this pattern (because it'll take me some time to write and I don't
want to do it if it won't be used).

Regarding some other people's suggestions, why wouldn't you use short
tags?! Those are awesome, make my views so much cleaner and more
readable, and save me finger pain. I believe cakePHP even has a
shorthand for echo(), which is e(), because <?php echo( is way too
much to write. So, I'll stick with my short tags thank you. Besides, I
control my server and my php.ini.

_V

P.S. Closing tags in PHP files other than views are unnecessary,
either.



On Mar 16, 3:25 am, anak newbie <anaknew...@gmail.com> wrote:
> Thanks Jacob!
>
> I see it
>
> then i should change all short_open_tags in my many apps and it's
> meaning pain :)
>
> cheers
>
> On Mon, 2010-03-15 at 05:05 -0700, jacmoe wrote:
> > I strongly advise not using them!
> > They doesn't make the template more clean - it makes it much harder to
> > spot the PHP code.
>
> > Allow me to quote from debuggable.com:
> > > The first thing I recommend is using the fully qualified syntax (<?php 
> > > ?>) for php tags instead of the short one (<? ?>). Why?
> > > Well that's what the CakePHP coding standards recommend you to use, and 
> > > it makes those statments stand out a little more in
> > > your html code. But the main reason still is that the short tags syntax 
> > > can be turned off via php.ini, so using them makes
> > > your app less portable and could cause raw code output incidents.
>
> > I am not a CakePHP expert, but it sounds right. :)
>
> > Jacob
>
> > On Mar 14, 10:26 pm, Miles J <mileswjohn...@gmail.com> wrote:
> > > This isn't a problem with CakePHP.
>
> > > Short tags are an INI setting within your PHP installation.
> > > Furthermore short tags are being completely removed or deprecated in
> > > future PHP versions, so its just best practice to stop using them.
>
> > > On Mar 14, 4:38 pm, anak newbie <anaknew...@gmail.com> wrote:
>
> > > > Yeap, you're right!
>
> > > > but somehow open_short_tag affect in making template more clean
>
> > > > i see it's support on another framework and i don't talk about comparing
> > > > something :D
>
> > > > Just an idea
>
> > > > On Sun, 2010-03-14 at 03:36 -0700, Miles J wrote:
> > > > > Its only 6 more characters to write <?php echo
>
> > > > > :P
>
> > > > > On Mar 14, 1:47 pm, anak newbie <anaknew...@gmail.com> wrote:
> > > > > > Perhaps someday it's can be fixed without open_short_tags enable.
>
> > > > > > IMHO, using open_short_tags giving clear templates code as well .
>
> > > > > > On Sat, 2010-03-13 at 14:36 -0800, Miles J wrote:
> > > > > > > That's the only way to fix it. Its an ini setting.
>
> > > > > > > On Mar 13, 11:07 am, John Andersen <j.andersen...@gmail.com> 
> > > > > > > wrote:
> > > > > > > > Please apply the solution you already know about, enable the 
> > > > > > > > short
> > > > > > > > tags in the php.ini file!
> > > > > > > > There is as far as I know, no other solution ... except for you 
> > > > > > > > to go
> > > > > > > > through all your source code and change from the short tag to 
> > > > > > > > the <?
> > > > > > > > php tag :)
> > > > > > > > Enjoy,
> > > > > > > >    John
>
> > > > > > > > On Mar 14, 6:36 am, anak newbie <anaknew...@gmail.com> wrote:
>
> > > > > > > > > Hello all,
>
> > > > > > > > > Today i am upgrading my server to PHP 5.3 and see something 
> > > > > > > > > trouble.
>
> > > > > > > > > My cakePHP get ugly and i see that open short tags doesn't 
> > > > > > > > > work.
>
> > > > > > > > > like <?=$post['Post']['title']?>
>
> > > > > > > > > I have many open short tags on everywhere.
>
> > > > > > > > > I know solution is to enable open , short tags on php.ini
>
> > > > > > > > > My question can it solved without short tags on php.ini ?
>
> > > > > > > > > Thanks
>
> > > > > > > Check out the new CakePHP Questions 
> > > > > > > sitehttp://cakeqs.organdhelpotherswith their CakePHP related 
> > > > > > > questions.
>
> > > > > > > You received this message because you are subscribed to the 
> > > > > > > Google Groups "CakePHP" group.
> > > > > > > To post to this group, send email to cake-php@googlegroups.com
> > > > > > > To unsubscribe from this group, send email to
> > > > > > > cake-php+unsubscr...@googlegroups.com For more options, visit 
> > > > > > > this group athttp://groups.google.com/group/cake-php?hl=en
>
> > > > > Check out the new CakePHP Questions 
> > > > > sitehttp://cakeqs.organdhelpothers with their CakePHP related 
> > > > > questions.
>
> > > > > You received this message because you are subscribed to the Google 
> > > > > Groups "CakePHP" group.
> > > > > To post to this group, send email to cake-php@googlegroups.com
> > > > > To unsubscribe from this group, send email to
> > > > > cake-php+unsubscr...@googlegroups.com For more options, visit this 
> > > > > group athttp://groups.google.com/group/cake-php?hl=en
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups 
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to