Re: Re: Set Variable = Long HTML String?

From: Date: Sat, 07 Oct 2006 16:03:27 +0000
Subject: Re: Re: Set Variable = Long HTML String?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-242799@lists.php.net to get a copy of this message
On 10/7/06, sit1way <sit1way@hotmail.com> wrote:
I'm overhauling my PHP based CMS and want to know how to set a variable equal to an HTML string, but without having to escape all the quotes!
Noah, meet HEREDOC. HEREDOC, meet Noah: http://uk.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc Now you cozy two, let's make it a party with the Complex (Curly {}) syntax: http://uk.php.net/manual/en/language.types.string.php#language.types.string.parsing.complex All together now! [code] $var =<<<HEREDOC <form name="events" method="POST" action=""> <select class="menus" name="news" onChange="MM_jumpMenu('parent',this,0);">
       <option selected="selected">News Options</option>
       <option value="{$this->doc_path}admin/news/add/1/">Add</option>
       <option value="{$this->doc_path}admin/news/update/1/">Update</option>
       <option value="{$this->doc_path}admin/news/delete/1/">Delete</option>
</select> </form> HEREDOC; [/code] HTH, John W
TIA, --Noah -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.general (#242799) next »