RE: [PHP] HTML via echo or not
| From: | Robert Cummings | Date: | Tue, 30 Dec 2003 01:36:22 +0000 |
| Subject: | RE: [PHP] HTML via echo or not | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-173459@lists.php.net to get a copy of this message | ||
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:sparkyk@blackmesa-isp.net]
> 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. |
`------------------------------------------------------------'