[ciapug] heredoc

vanish at dreamscapevisionery.com vanish at dreamscapevisionery.com
Tue Mar 14 16:14:32 CST 2006


Yes, and that works fine. I was just trying to see whether or not it's 
possible
to do it directly in the object syntax. I can't find any reference on 
it online
at all, so I'm guessing it's not.

Chris VC

Quoting Jerry Weida <jweida at gmail.com>:

> 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
>
> _______________________________________________
> ciapug mailing list
> ciapug at cialug.org
> http://cialug.org/mailman/listinfo/ciapug
>





More information about the ciapug mailing list