[ciapug] heredoc
Jerry Weida
jweida at gmail.com
Tue Mar 14 07:15:17 CST 2006
Have you tried
$webPageContent = <<<HTML
....
HTML
$webPage->addContent($webPageContent);
Jerry
On Mar 13, 2006, at 2:53 PM, Chris Van Cleve wrote:
> Say I have the following code which inserts content into a web page
> through a class:
>
> // Add something to the body of the page
> $webPage->addContent("
> <h1>Administration Menu</h1>
> <dl>
> <dt><a href='ticker.php'>Headline Ticker Management</a></dt>
> <dd>View, Add, Edit, Delete items for the Headline Ticker</dd>
> <dt><a href='news.php'>News Management</a></dt>
> <dd>View, Add, Edit, Delete, Publish items for departmental
> and company-wide news</dd>
> <dt><a href='#'>Event Management</a></dt>
> <dd>View, Add, Edit, Delete items from the company-wide
> calendar of events</dd>
> </dl>
> " );
>
> But I want to use heredoc syntax instead of the long quoted string.
> When I try this:
>
> // Add something to the body of the page
> $webPage->addContent(<<<HTML
> <h1>Administration Menu</h1>
> <dl>
> <dt><a href='ticker.php'>Headline Ticker Management</a></dt>
> <dd>View, Add, Edit, Delete items for the Headline Ticker</dd>
> <dt><a href='news.php'>News Management</a></dt>
> <dd>View, Add, Edit, Delete, Publish items for departmental
> and company-wide news</dd>
> <dt><a href='#'>Event Management</a></dt>
> <dd>View, Add, Edit, Delete items from the company-wide
> calendar of events</dd>
> </dl>
> HTML;
> );
>
> It breaks. This is the only situation I've come across where I
> can't get heredoc to work. Granted I haven't spent a great deal of
> energy on solving this because it's an issue of convenience, but
> before I got troughing the php.net comments I thought I would see
> if someone here had some quick insight for me.
>
> Chris VC
>
> _______________________________________________
> ciapug mailing list
> ciapug at cialug.org
> http://cialug.org/mailman/listinfo/ciapug
More information about the ciapug
mailing list