[ciapug] Re: heredoc
Mike Parks
mparks at captainjack.com
Tue Mar 14 12:12:43 CST 2006
With heredoc I have found that it works this way
$webPageContent = <<<HTML
Has to start at the very first column of the next row
then it can be formatted in any way you wish???
HTML;
$webPage->addContent($webPageContent);
If it is not formatted correctly, the content inside the heredoc
wrappers does not appear.
Mike
At 12:00 PM 3/14/2006, you wrote:
>Send ciapug mailing list submissions to
> ciapug at cialug.org
>
>To subscribe or unsubscribe via the World Wide Web, visit
> http://cialug.org/mailman/listinfo/ciapug
>or, via email, send a message with subject or body 'help' to
> ciapug-request at cialug.org
>
>You can reach the person managing the list at
> ciapug-owner at cialug.org
>
>When replying, please edit your Subject line so it is more specific
>than "Re: Contents of ciapug digest..."
>
>
>Today's Topics:
>
> 1. heredoc (Chris Van Cleve)
> 2. Re: heredoc (Jerry Weida)
>
>
>----------------------------------------------------------------------
>
>Message: 1
>Date: Mon, 13 Mar 2006 14:53:52 -0600
>From: Chris Van Cleve <vanish at dreamscapevisionery.com>
>Subject: [ciapug] heredoc
>To: ciapug at cialug.org
>Message-ID:
> <04CED172-F978-4D70-ACA5-38E94B13DDD6 at dreamscapevisionery.com>
>Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
>
>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
>
>
>
>------------------------------
>
>Message: 2
>Date: Tue, 14 Mar 2006 07:15:17 -0600
>From: Jerry Weida <jweida at gmail.com>
>Subject: Re: [ciapug] heredoc
>To: ciapug at cialug.org
>Message-ID: <52C1880E-D856-422C-8B30-5B86F3856EE5 at gmail.com>
>Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
>
>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
>
>
>End of ciapug Digest, Vol 11, Issue 8
>*************************************
<><><><><><><><><><><><><><><>
Mike Parks
Captain Jack Communications
Email: techsupport at captainjack.com
Phone: 515-964-8500
Toll-Free: 800-581-3230
More information about the ciapug
mailing list