Re: jumping between php and html or using echo for printing html-tags.
| From: | Askengren | Date: | Sat, 08 Feb 2003 22:51:25 +0000 |
| Subject: | Re: jumping between php and html or using echo for printing html-tags. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-134954@lists.php.net to get a copy of this message | ||
I do not know why so many developers use the "-character (double quote)
instead of ' (single quote) in php/html-scripts.
Much easier is:
function admin_menu() {
echo "<B> Meny </B><BR>";
echo "<A HREF='" . $_SERVER['PHP_SELF'] . "?action=" .
MANAGE_MEMBERS
."'>Medlemmar</A><BR>";
.....
You do then not have to worry about all backslashes.
And single quote is w3c html-standard just as double quote.
And it?s faster - you do not have to switch between html and php so often.
/Håkan
"Anders Thoresson" <listor@thoresson.net> skrev i meddelandet
news:oprj6xvc1vzzwwoi@mail.darkface.pp.se...
> Which is more efficient:
>
> function admin_menu() {
> echo "<B> Meny </B><BR>";
> echo "<A HREF=\"" . $_SERVER['PHP_SELF'] . "?action=" .
> MANAGE_MEMBERS .
> "\">Medlemmar</A><BR>";
> echo "<A HREF=\"" . $_SERVER['PHP_SELF'] . "?action=" .
> MANAGE_ALBUMS .
> "\">Album</A><BR>";
> echo "<A HREF=\"" . $_SERVER['PHP_SELF'] . "?action=" .
> INITIAL_PAGE .
> "\">Huvudmeny</A><BR>";
> echo "<A HREF=\"" . $_SERVER['PHP_SELF'] . "?action=" .
> LOG_OUT .
> "\">Logga ut</A><BR>";
> }
>
> or
>
> function admin_menu() {
> ?>
> <B> Meny </B><BR>
> <A HREF="<?=$_SERVER['PHP_SELF']?>?action=<?php
> echo(MANAGE_MEMBERS)
> ;?>">Medlemmar</A><BR>
> <A HREF="<?=$_SERVER['PHP_SELF']?>?action=<?php
> echo(MANAGE_ALBUMS)
> ;?>">Album</A><BR>
> <A HREF="<?=$_SERVER['PHP_SELF']?>?action=<?php echo(INITIAL_PAGE)
> ;?>">Huvudmeny</A><BR>
> <A HREF="<?=$_SERVER['PHP_SELF']?>?action=<?php
> echo(LOG_OUT);?>">Logga
> ut</A><BR>
> <?php
> }
>
> Any reasons other than speed to choose either?
>
> --
> anders thoresson