Hi :) I'm trying to put a stop in a foreach statement following the user suggestion here, php.net/manual/en/control-structures.foreach.php
Not really knowing what I am doing, I am running into some synatx problems. I'm sure I'm doing something really stupid, can anybody point it out? This is the original statement that works... foreach ($this->_content as $item) { if ($item['type'] == 'item'){ $elements['ITEM_LINK'] = $item['link']; $elements['ITEM_TITLE'] = $item['title']; $elements["TARGET"] = $this->_target; $items .= PHPWS_Template::processTemplate($elements, "phpwsrssfeeds", "block_item.tpl"); } } This is my attempt to count items and put a stop in the foreach so it only returns 5 items. foreach ($this->_content as $n => $item) { if ($n=="5") { break; } else { if ($this->_content[$n] => $item['type'] == 'item'){ $elements['ITEM_LINK'] = $this->_content[$n] => $item['link']; $elements['ITEM_TITLE'] = $this->_content[$n] => $item['title']; $elements["TARGET"] = $this->_target; $items .= PHPWS_Template::processTemplate($elements, "phpwsrssfeeds", "block_item.tpl"); } } } Php doesn't like the syntax on any of the, $this->_content[$n] => $item['type'] , etc lines TIA, Verdon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php