output buffering - HTML into PHP Variable (HTML outside PHP code) -


I'm new to php and I'm thinking that something like this might happen:

  & Lt; Php ... magic function start (); ? & Gt; & Lt; Html & gt; & Lt; Top & gt; ... & lt; / Head & gt; & Lt; Body & gt; ... & lt; / Body & gt; & Lt; / Html & gt; & Lt ;? Php $ variable = magicFunctionEnd (); ...? & Gt;  

I have to use now

  & lt; Php ... $ variable = " 
head> gt ... & gt; & lt; Lt; / html & gt ;? & Gt;

Which is not annoying and unreadable.

Have you tried "output buffering"?

  & lt ;? Php ... ob_start (); ? & Gt; & Lt; Html & gt; & Lt; Top & gt; ... & lt; / Head & gt; & Lt; Body & gt; ... & lt ;? Php is a more reactive echo? & Gt; & Lt; / Body & gt; & Lt; / Html & gt; & Lt ;? Php $ variable = ob_get_clean (); ...? & Gt;  

Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -