SHort tags
Moderator: General Moderators
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
SHort tags
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?
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?
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: SHort tags
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
Sources please?
EDIT | found it - http://www.php.net/~derick/meeting-notes.html#id66
Re: SHort tags
http://www.corephp.co.uk/archives/19-Pr ... PHP-6.htmlThey will remove support for the ASP style tags, but the PHP short-code tag will remain (<?)
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
Sweet, thanks for that link. 
Re: SHort tags
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
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.Personally I consider them bad practice since they are off on some server configurations, making the code less portable.
I have my work cut out for me, for sure. Thankfully as developers we crave a challenge.
Re: SHort tags
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.
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.
Re: SHort tags
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.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.
Re: SHort tags
They sure do throw funny errors, too.pytrin wrote: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.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.
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.
Re: SHort tags
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
)
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: SHort tags
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
Seems like someone is playing devils advocate
Re: SHort tags
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
hahahaha cheers
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Re: SHort tags
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.
Re: SHort 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 caseI 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.
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Re: SHort tags
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...
Short tags are nice in alternative syntax templates though...