Re: eof bof in php

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2008-12-22 at 15:04 -0500, Anthony Gentile wrote:
> Well you said it...for my example it makes sense. For when it gets really
> messy by all means concatenate with php. However, my argument is not so much
> keeping html seperate from php as it is keeping the business logic separate
> from the presentation....so if you have php writing html and its all dealing
> with the presentation...I personally don't think its a problem. However when
> you start writing html out with php in your business logic...to me that's a
> no no.
> 
> Anthony Gentile
> 
> 
> 
> On Mon, Dec 22, 2008 at 2:47 PM, Ashley Sheridan
> <ash@xxxxxxxxxxxxxxxxxxxx>wrote:
> 
> > On Mon, 2008-12-22 at 14:21 -0500, Anthony Gentile wrote:
> > > I would argue it is better practice as:
> > >
> > > <h1><?php echo 'Hello World'; ?></h1>
> > >
> > > than
> > >
> > > <?php
> > > echo "<h1>Hello World</h1>";
> > > ?>
> > > Anthony Gentile
> > >
> > >
> > > On Mon, Dec 22, 2008 at 9:18 AM, tedd <tedd.sperling@xxxxxxxxx> wrote:
> > >
> > > > At 1:21 PM -0500 12/21/08, Anthony Gentile wrote:
> > > >
> > > >> -snip exampe-
> > > >>
> > > >>
> > > >> is probably going to give you the result you want. However you should
> > know
> > > >> it is bad practice to mix PHP and HTML as horridly as I just showed
> > you.
> > > >> AKA
> > > >> you don't want your PHP writing your HTML.
> > > >>
> > > >> Anthony Gentile
> > > >>
> > > >
> > > > Anthony:
> > > >
> > > > Granted, the example you gave was a bit mixed, but it's perfectly Okay
> > to
> > > > have php write html. In fact, if you think about it that's the only way
> > php
> > > > can express itself to the user. A simple echo($var) is writing html to
> > a
> > > > browser.
> > > >
> > > > Good practice should to write code (i.e., php, mysql, css, html, js)
> > that
> > > > is semantic and compliant with standards. Mixing them well is almost an
> > art
> > > > form that observes best practices in all.
> > > >
> > > > Cheers,
> > > >
> > > > tedd
> > > >
> > > > --
> > > > -------
> > > > http://sperling.com  http://ancientstones.com  http://earthstones.com
> > > >
> > > > --
> > > > PHP General Mailing List (http://www.php.net/)
> > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > >
> > > >
> > Why?! As you've seen, it can get awfully messy very quickly...
> >
> >
> > Ash
> > www.ashleysheridan.co.uk
> >
> >
I largely tend towards using heredoc syntax wherever possible, as it
lets you separate the PHP and HTML in the way you want, yet still allows
you to have variable output inside the HTML. I hate repetitious breaking
out of HTML code just to output a variable or two.


Ash
www.ashleysheridan.co.uk


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux