Re: Embedding foreach loops

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

 



On Tue, 2009-08-11 at 07:13 +0000, hessiess@xxxxxxxxxxxx wrote:
> Do *NOT* get into the habit of outputting your HTML using echo or print
> statements, it becomes unmaintainable very quickly, use a templating
> language, ether with a framework(recomended) or standalone.
> 
> You should learn the basics of HTML and CSS, go and read
> http://htmldog.com/, btw to add a newline you need to use "<br />".
> 
> >> I am using the print function to display my html. I cannot get the
> >> line return ( \n ) character to actually push the html onto the next
> >> line, it just gets displayed instead. Should I be using echo?
> >
> >
> > Allen, you off and running again?
> >
> > echo "blah..  \n"; //<-- this will print  the literal 'blah..  '  and
> > then a newline into your HTML *source code*
> > echo 'blah..  \n'; //<-- this will print the literal 'blah..  \n' into
> > your HTML *source code*
> >
> > IIRC print is the same as echo.  That is not your apparent issue.
> >
> > Say if you are stuck again, and on what exactly.
> >
> > -John
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> 
> 

*Or* you could use the heredoc syntax, which I'm quite a fan of.

print <<<EOC
<p>some content here</p>
<p>content with a php $variable here</p>


<p>this gets displayed after the extra new lines in the source</p>
EOC;

Still easy to maintain.

Thanks,
Ash
http://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