Re: How to print normally html code ?



On Thu, 15 May 2008 09:30:57 GMT, Raymond.Schmit@xxxxxxxxxxx (Raymond
SCHMIT) wrote:

On 15 May 2008 02:24:38 GMT, Kim André Akerø
<kimandre@xxxxxxxxxxxxxxxxxx> wrote:

Raymond SCHMIT wrote:

On Mon, 12 May 2008 16:44:23 -0700 (PDT), NC <nc@xxxxxxxxx> wrote:

On May 12, 4:18 pm, Raymond.Sch...@xxxxxxxxxxx (Raymond SCHMIT)
wrote:

Is it possible to have this kind of coding ?:

if ($myhost=="www.fur4x-hebergement.net")
{
print until _THELABEL
free hosted at <a href="http://www.fur4x-hebergement.net/";
TARGET="_blank">Fur4x</a>";
._THELABEL
}

Yes. Read up on heredoc syntax:

http://us2.php.net/string#language.types.string.syntax.heredoc


Thanks for the link giving me the syntax.

But i am afraid that before the EOT; label we must use :

free hosted at <a href=\"http://www.fur4x-hebergement.net/\";
TARGET=\"_blank\"\>Fur4x</a\>

instead of :

free hosted at <a href="http://www.fur4x-hebergement.net/";
TARGET="_blank">Fur4x</a>

The heredoc can use any closing identifier of your choosing; the
closing identifier string is defined at the beginning (right after the
<<<), and the string contents will stop once it reaches the next
occurrence of that string (concluded by a semicolon, which will end
that code "line"). It only needs to be the same at the beginning and
the end. Personally, I prefer using something that will *never* show up
in any given string.

Example:

$html_footer = <<<__WHATEVER_YOU_WANT_TO_MAKE_IT_STOP__
hosted for free at <a href="http://www.example.com/";
TARGET="_blank">The Example Hosting Company, Inc.</a>
__WHATEVER_YOU_WANT_TO_MAKE_IT_STOP__;


I agree with you, it's really better - because EOt could be present
:-)

However ... to use this "footer" we need to have :
echo $html_footer;

....therefore my question is still ...
....
Could we use:
hosted for free at <a href="http://www.example.com/";
TARGET="_blank">The Example Hosting Company, Inc.</a>

instead of:
hosted for free at <a href=\"http://www.example.com/\";
TARGET=\"_blank\"\>The Example Hosting Company, Inc.</a\>

?
YES ! I just finished testing - all goes well - so i can write
normal html code inside a php variable,(then echo them, without
playing with the "\" character.

Thanks for all of you !
.



Relevant Pages

  • Re: set user=%username%
    ... Your most recent feedback confirms that Windows is ... Type this: echo %MyName% ... > usertest=This is a long string. ...
    (microsoft.public.windows.server.general)
  • Re: its not the school home work
    ... I've learned a bit about strong quotes and think I realized when to ... the shell (such as in the $var, but also for the spaces (that ... echo "foo bar" ... you may say that $string does not appear in /list/ context so ...
    (comp.unix.shell)
  • Re: TRUE and FALSE are treated differently
    ... No -- you can't echo a boolean in PHP. ... If you look up the manual on type casting, you'll find that FALSE is cast ... to an empty string, and TRUE is cast to a non-empty string. ...
    (comp.lang.php)
  • Re: TRUE and FALSE are treated differently
    ... No -- you can't echo a boolean in PHP. ... the boolean is implicitly cast to a string. ... If you look up the manual on type casting, you'll find that FALSE is cast to an empty string, and TRUE is cast to a non-empty string. ...
    (comp.lang.php)
  • Re: TRUE and FALSE are treated differently
    ... No -- you can't echo a boolean in PHP. ... the boolean is implicitly cast to a string. ... If you look up the manual on type casting, you'll find that FALSE is cast to an empty string, and TRUE is cast to a non-empty string. ...
    (comp.lang.php)