PDA

View Full Version : PHP: multi-line print?


WarGiant
02-27-2003, 06:51 PM
hey everybody...been a long time since I last posted here :p anyway....
Ok, I am working on a CMS project for my site, and I have a whole lot of it done (yay!). I have come to parts where I have to print lots of html stuff (for control panel).

As far as I know, in PHP, you have to make a print ""; for each separate line (unless you want to have a super long string that stretches the screen an absurd amount).
I know that in Perl, you could just use

print qq~
all html code here,
formatted however you want,
you don't need to backslash escape any special symbols.
~;


I want to know, is there anything like that in PHP? It would make this a lot easier for me (I know, I know...I'm being lazy). This is mainly only for testing purposes. After I have all the html and code stuff done, I plan to move all the html blocks into the db and have it grab the html from there like it does with the pages.

scoutt
02-27-2003, 09:42 PM
well this is very valid


echo" some text
to output
to the screen";

// or you can use here-doc syntax

echo <<<myHtml
some txt here also some html and you can also use "
in this syntax without escaping them.
the ending is the same as the begining

myHtml;



that works well too.

WarGiant
02-27-2003, 10:45 PM
thx for enlightening me.

WarGiant
02-28-2003, 04:28 PM
Is there anything like that for assigning a value to a variable?

EX(in perl you could):
$HTML = qq~ your html code ~;

scoutt
02-28-2003, 04:31 PM
no, you have to escape the quotes.

WarGiant
02-28-2003, 11:37 PM
Darn...that's disappointing.

oh well, Thanks for info.