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

MySql variables and php -

url rewriting - How to implement the returnurl like SO in PHP? -

Which Python client library should I use for CouchdB? -