SHort tags

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

SHort tags

Post by alex.barylski »

Are they not being phased out and generally considered a bad practice?

I started on a new project and the codebase is a mangle of HTML/SQL/PHP/JS/CSS all in a single file. To make matters worse, there are several scripts which do more than one thing.

members.php => Would show a paginated list of members
members.php?id=2 = Would show a single member profile

One of the first things I'm trying to get across to everyone is the importance of separating the HTML from the PHP code and in doing so enforce some standard/convention and NOT use short tags (which is heavily used).

I have googled but is PHP 6 not supporting short tags?
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: SHort tags

Post by John Cartwright »

If memory serves, they are removing ASP style tags, not short tags.

Sources please?

EDIT | found it - http://www.php.net/~derick/meeting-notes.html#id66
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: SHort tags

Post by Benjamin »

They will remove support for the ASP style tags, but the PHP short-code tag will remain (<?)
http://www.corephp.co.uk/archives/19-Pr ... PHP-6.html

They still shouldn't be used however.
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: SHort tags

Post by alex.barylski »

Sweet, thanks for that link. :)
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: SHort tags

Post by Eran »

Personally I consider them bad practice since they are off on some server configurations, making the code less portable.
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: SHort tags

Post by alex.barylski »

Personally I consider them bad practice since they are off on some server configurations, making the code less portable.
That would typically be a good concern, only in controlled environments that argument doesn't really hold legit weight. Although I could probably say that still and test the waters for rebuttle. :P

I have my work cut out for me, for sure. Thankfully as developers we crave a challenge. :)
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Re: SHort tags

Post by s.dot »

I would open all of the code in my editor and do a regex replace on '<?\w' and replace it with <?php ;d
Or, if I were nifty with linux I'd do it from the command line.. I do believe a recursive replace is possible.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: SHort tags

Post by Eran »

That would typically be a good concern, only in controlled environments that argument doesn't really hold legit weight. Although I could probably say that still and test the waters for rebuttle. :P
Unless you write different code on different systems, or are writing (and will always write) for one system only, that can not be always true. It's better to get used to writing long-tags than using short-tags when they can break things up.
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Re: SHort tags

Post by s.dot »

pytrin wrote:
That would typically be a good concern, only in controlled environments that argument doesn't really hold legit weight. Although I could probably say that still and test the waters for rebuttle. :P
Unless you write different code on different systems, or are writing (and will always write) for one system only, that can not be always true. It's better to get used to writing long-tags than using short-tags when they can break things up.
They sure do throw funny errors, too.
Especially if in included files.. can be hard to figure out where the short tag is.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: SHort tags

Post by josh »

Why should I break the habit if I can just run a regexp if I do decide to OS my codebase? ( short tags that is, not mixing cross cutting concerns ;-) )
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: SHort tags

Post by John Cartwright »

Nobody is forcing you to use the long php tags. However, the point being made is situations may arise where short tags are disabled. If such a situation can be avoided, and subsequently making code more portable, then why not is the question?

Seems like someone is playing devils advocate :)
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: SHort tags

Post by josh »

Well to prove something you can disprove it's contradiction, was just trying to derive wether or not its bad practice! I say no!

hahahaha cheers
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: SHort tags

Post by alex.barylski »

I was sure I mentioned the server is in our direct control so disabling short tags is not a concern. If it's being phased out, that argument would hold far more weight, but apparently they are keeping them, so I guess were keeping the tags.
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: SHort tags

Post by Eran »

I was sure I mentioned the server is in our direct control so disabling short tags is not a concern. If it's being phased out, that argument would hold far more weight, but apparently they are keeping them, so I guess were keeping the tags.
I was referring directly to what you said. If you believe you will work on this server for this company for the rest of your career then it shouldn't be a problem. For the rest of us.. I think it's probably not the case
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: SHort tags

Post by alex.barylski »

I don't think I'll work here for the rest of my career...I will be here for a while though...when I am satisified I have done everything I can for the project and they are in good hands I will likely persue other projects...but yes the server will always be in their direct control.

Short tags are nice in alternative syntax templates though...
Post Reply