Re: Print inside a variable
| From: | Maxwell Brodie | Date: | Wed, 11 May 2005 03:49:38 +0000 |
| Subject: | Re: Print inside a variable | ||
| References: | 1 2 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-25992@lists.php.net to get a copy of this message | ||
I'm Very sorry, but I did not understand the lot of that, however I just got
out a book from the library that might explain it.
"Louis Solomon" <php-louis@steelbytes.com> wrote in message
news:20050503034226.83780.qmail@lists.php.net...
> try something more like this ... (very simplified to demonstrate)
>
> $myarray = array('fred','bob','jane');
> $msg = '';
> for ($i=0;$i<count($myarray);++$i)
> $msg .= 'item '.(string)$i.' = '.$myarray[$i].'<br>';
> echo $msg;
>
> --
> Louis Solomon
> www.SteelBytes.com
>
> "Maxwell Brodie" <max.b@shaw.ca> wrote in message
> news:20050503033533.72948.qmail@lists.php.net...
>> Hello,
>>
>> I believe my problem is that I have to use the print funtion inside a
>> variable, and I have no clue how to do that. For example, I need to get
>> this:
>>
>> if (isset($rss_channel["ITEMS"])) {
>> if (count($rss_channel["ITEMS"]) > 0) {
>> for($i = 0;$i < count($rss_channel["ITEMS"]);$i++) {
>> if (isset($rss_channel["ITEMS"][$i]["LINK"])) {
>> print ("\n<div class=\"itemtitle\"><a href=\"" .
>> $rss_channel["ITEMS"][$i]["LINK"] . "\">" .
>> $rss_channel["ITEMS"][$i]["TITLE"] .
>> "</a></div>");
>> } else {
>> print ("\n<div class=\"itemtitle\">" .
>> $rss_channel["ITEMS"][$i]["TITLE"] . "</div>");
>> }
>> print ("<div class=\"itemdescription\">" .
>> $rss_channel["ITEMS"][$i]["DESCRIPTION"] . "</div><br
>> />"); }
>> } else {
>> print ("<b>There are no articles in this feed.</b>");
>> }
>> }
>>
>> Into variable "$message="
>>
>> Any help would be appriciated MUCH!
>>
>> Thank you!