|
|
|
|
|
для: TrollFess
(30.07.2007 в 14:51)
| | С какого-то перепоя в PHP нельзя использовать методы в контексте аргументов, поэтому выносите их из вызовов функций
<?php
$str = $this->rss_index;
foreach ($this->escape($str) as $item)
{
$arr = $this->rss_items[];
$this->escape($arr) = array(
'title' => $item->title(),
'link' => $item->link(),
'description' => $item->description());
unset($arr);
}
?>
|
| |
|
|
|
|
|
|
| Использую фреймфорк Zend FrameWork, но вот возникла ошибка
Fatal error: Can't use method return value in write context in
Я использую класс Zend_Feed для импорта RSS, а в мануалах нашел код, для его использования. В контроллере у меня код такой:
function rssAction()
{
$this->view->title = "Rss";
$Rss = Zend_Feed::import('http://rss.slashdot.org/Slashdot/slashdot');
$channel = array(
'title' => $Rss->title(),
'link' => $Rss->link(),
'description' => $Rss->description(),
'items' => array()
);
$this->view->rss_title = $channel['title'];
$this->view->rss_link= $channel['link'];
$this->view->rss_description= $channel['description'];
$this->view->rss_items= $channel['items'];
$this->view->rss_index= $Rss;
}
|
А в виде:
<?php echo $this->render('header.phtml'); ?>
<h1><?php echo $this->escape($this->title); ?></h1>
<table>
<tr>
<th>Title</th>
<th> </th>
</tr>
</table>
<a href="<?php
echo $this->escape($this->rss_link);
?>"><?php
echo $this->escape($this->rss_title);
?></a>
<table>
<tr>
<th>Description</th>
<th> </th>
</tr>
</table>
><?php
echo $this->escape($this->rss_description);
foreach ($this->escape($this->rss_index) as $item)
{$this->escape($this->rss_items[]) = array(
'title' => $item->title(),
'link' => $item->link(),
'description' => $item->description());
}
?>
<?php echo $this->render('footer.phtml'); ?>
|
И проблема возникает вот из за этого кода:
foreach ($this->escape($this->rss_index) as $item)
{$this->escape($this->rss_items[]) = array(
'title' => $item->title(),
'link' => $item->link(),
'description' => $item->description());
}
|
Если я его вставлю в контроллер, поменяв конечно путь к переменным, то он работает. Но мне нужно что бы он был в Виде. И вот думаю, из за чего здесь может быть ошибка.... | |
|
|
|
|