[PHP] HTML via echo or not
Good evening. I'm probably going to stir up a hornet's nest but have a question. Does using echo for ALL html pages mean I have a sick mind? Example: echo CR, 'HTML', CR, ' BODY', CR, ' etc...'; I like the look. It's more readable, gives me a better view of variables as they are all single-quoted and stand out nicely in my editor. No messy jumping into and out of php. I have looked at a bunch of php code written by others and HEREDOC looks stupid with everything jammed against the left side of the screen, php tags within HTML breaks up the flow of properly formatted HTML, which I firmly require for all of my code, and just doesn't look right. 'print' makes you add \ to all of the HTML attributes but the 'echo' method makes everything look like php! Since all your doing is dumping text to the output subsystem, there shouldn't be any speed decrease in the code. Yes, I know, there are advocates for every kind of method to display HTML code but just wanting to get others opinions on the subject. If you wish, email me off-list @ sparkyk-AT-blackmesa-isp.net. Cheers! Robin 'Sparky' Kopetzky Black Mesa Computers/Internet Service Grants, NM 87020 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] HTML via echo or not
I agree. I think embedding the ?php ? tags is messy and harder to follow. I do however, treat echo like print. ie echo The thought would \have\ to be clear.; I've not use CR,. I'll have to look at that. Thanks -Original Message- From: Robin Kopetzky [mailto:[EMAIL PROTECTED] Sent: Monday, December 29, 2003 8:02 PM To: PHP General Subject: [PHP] HTML via echo or not Good evening. I'm probably going to stir up a hornet's nest but have a question. Does using echo for ALL html pages mean I have a sick mind? Example: echo CR, 'HTML', CR, ' BODY', CR, ' etc...'; I like the look. It's more readable, gives me a better view of variables as they are all single-quoted and stand out nicely in my editor. No messy jumping into and out of php. I have looked at a bunch of php code written by others and HEREDOC looks stupid with everything jammed against the left side of the screen, php tags within HTML breaks up the flow of properly formatted HTML, which I firmly require for all of my code, and just doesn't look right. 'print' makes you add \ to all of the HTML attributes but the 'echo' method makes everything look like php! Since all your doing is dumping text to the output subsystem, there shouldn't be any speed decrease in the code. Yes, I know, there are advocates for every kind of method to display HTML code but just wanting to get others opinions on the subject. If you wish, email me off-list @ sparkyk-AT-blackmesa-isp.net. Cheers! Robin 'Sparky' Kopetzky Black Mesa Computers/Internet Service Grants, NM 87020 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML via echo or not
Why make PHP work harder than it needs to? Jordan Robin Kopetzky wrote: Good evening. I'm probably going to stir up a hornet's nest but have a question. Does using echo for ALL html pages mean I have a sick mind? Example: echo CR, 'HTML', CR, ' BODY', CR, ' etc...'; I like the look. It's more readable, gives me a better view of variables as they are all single-quoted and stand out nicely in my editor. No messy jumping into and out of php. I have looked at a bunch of php code written by others and HEREDOC looks stupid with everything jammed against the left side of the screen, php tags within HTML breaks up the flow of properly formatted HTML, which I firmly require for all of my code, and just doesn't look right. 'print' makes you add \ to all of the HTML attributes but the 'echo' method makes everything look like php! Since all your doing is dumping text to the output subsystem, there shouldn't be any speed decrease in the code. Yes, I know, there are advocates for every kind of method to display HTML code but just wanting to get others opinions on the subject. If you wish, email me off-list @ sparkyk-AT-blackmesa-isp.net. Cheers! Robin 'Sparky' Kopetzky Black Mesa Computers/Internet Service Grants, NM 87020 -- I am nothing but a poor boy. Please Donate.. https://www.paypal.com/xclick/business=list%40racistnames.comitem_name=Jordan+S.+Jones -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] HTML via echo or not
I use a templating framework in which I put all of my HTML. However, when I create components that need to output HTML to render themselves then I use the echo and single quote style also. I find heredoc and breaking in and out of PHP to be extremely messy looking, not to mention horribly maintainable. Double quotes versus single quotes is more a matter of preference, for instance when doing SQL queries I like to use double quotes instead since I quote my SQL strings in single quotes. Cheers, Rob. On Mon, 2003-12-29 at 20:03, Larry Brown wrote: I agree. I think embedding the ?php ? tags is messy and harder to follow. I do however, treat echo like print. ie echo The thought would \have\ to be clear.; I've not use CR,. I'll have to look at that. Thanks -Original Message- From: Robin Kopetzky [mailto:[EMAIL PROTECTED] Sent: Monday, December 29, 2003 8:02 PM To: PHP General Subject: [PHP] HTML via echo or not Good evening. I'm probably going to stir up a hornet's nest but have a question. Does using echo for ALL html pages mean I have a sick mind? Example: echo CR, 'HTML', CR, ' BODY', CR, ' etc...'; I like the look. It's more readable, gives me a better view of variables as they are all single-quoted and stand out nicely in my editor. No messy jumping into and out of php. I have looked at a bunch of php code written by others and HEREDOC looks stupid with everything jammed against the left side of the screen, php tags within HTML breaks up the flow of properly formatted HTML, which I firmly require for all of my code, and just doesn't look right. 'print' makes you add \ to all of the HTML attributes but the 'echo' method makes everything look like php! Since all your doing is dumping text to the output subsystem, there shouldn't be any speed decrease in the code. Yes, I know, there are advocates for every kind of method to display HTML code but just wanting to get others opinions on the subject. If you wish, email me off-list @ sparkyk-AT-blackmesa-isp.net. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML via echo or not
On Mon, 2003-12-29 at 20:34, Jordan S. Jones wrote: Why make PHP work harder than it needs to? A decent compile cache will optimize literal concatenation so that only variables are concatenated at run time. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML via echo or not
Robin -- ...and then Robin Kopetzky said... % % Good evening. Hiya! % % I'm probably going to stir up a hornet's nest but have a question. Probably so :_0 % % Does using echo for ALL html pages mean I have a sick mind? Example: I don't think so. % % echo CR, 'HTML', %CR, ' BODY', %CR, ' etc...'; OK, that does look a bit sick :-) If nothing else, you end up with a blank line before your first tag, which is technically a no-no. I personally terribly dislike the jump-in-and-out bit, so only when I have to use javascript and have to quote it do I even think about that. I should also get around to using templates, but I haven't yet, so my answer might be different later. I have a vague grasp of the nirvana of separating the presentation formatting from the actual work and would like to get there someday. In my copious time between midnight and 4am, I suppose. Oh, wait; I'm in that now. I may have to sleep in 'til 4:30 to make up for it *yawn* I also use print for everything rather than echo; I use '' on my HTML attributes within my print s and so I don't look like a B movie (that's B for backslasher :-) When printing large chunks I don't bother with HEREDOCs but have been known to print table tr tdcell/td tdcell/td /tr /table There was a table. ; or so. It's easier to write than all of the quoting on and off that you describe (plus I use \n rather than CR, not having seen it before and thus not knowing if it's a predefined constant or one you did). I tend to get a bit lazy with my HTML and often don't sweat the formatting for the sake of the browser, though I do use newlines for at least a token consideration of anyone reading the output :-) The php is much more important to me than the resultant HTML. Good luck coming to a sane final decision :-) HTH HAND Happy Holidays :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature