We are not writing in perl...

Php offers a very handy feature, the ability to go in and out of html/php 
code by just using <?  ?> and the ability to echo data by using <?= $var ?>

Seperate as much of your HTML from your PHP as possible.  It will assist in 
readability, and
maintenance.

---------------------------------------------------
<?php
         $color = "#FFCC00";
         $name  = "Yogi";
?>
<font color="<?= $color ?>">The bear is <?= $name ?>.</font>
---------------------------------------------------

-Jason Garber
IonZoft.com




At 05:36 PM 11/18/2001 -0800, you wrote:
>I _hate_ echo'n out big batches of HTML, so I never do it.  I prefer to
>include HTML, or have a class or function write HTML.  However, printing
>in heredoc style is very handy ... more so than sliced bread.
>
>For example:
>
><?php
>         $color = "#FFCC00";
>         $name  = "Yogi";
>
>         print <<<EOF
>         <font color="${color}">The bear is ${name}.</font>
>         <!-- this can be as much plain HTML intermixed with PHP
>              variables as you like -->
>EOF;
>         print( date() );
>?>
>
>PHP code, followed by plain HTML (I put in some PHP variables, but they
>aren't necessary) (without a bunch of echo/print calls, or having to
>escape quotes), followed by more PHP ... wash, rinse, repeat as much as
>necessary ... you get the picture.  It works out rather nicely.
>
>         $0.02
>         ~Chris                           /"\
>                                          \ /     September 11, 2001
>                                           X      We Are All New Yorkers
>                                          / \     rm -rf /bin/laden
>
>On Sun, 18 Nov 2001, Brad Melendy wrote:
>
> > Hello,
> > Other than the fact that sometimes, you just can't get raw HTML to process
> > properly by dropping out of PHP code, what are the pros and cons of using
> > RAW HTML or just ECHOING everything in PHP?  Thanks for any insights.
> >
> > ..Brad
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to