Hello,
I want a little help explain to me what went wrong.
I want to load data from external json file.
My template is
And receive this error>
The controller is:
And the Helper_News class for this is:
I want to load last 5 News from json file.
Api structure is
Thanks for helping undestand this problem.
Regards.
I want a little help explain to me what went wrong.
I want to load data from external json file.
My template is
Code:
<xen:foreach loop="$news" value="$new">
<li>
<span class="title">{$new.title}</span>
<span class="subtitle">{$new.stitle}</span>
</li>
</xen:foreach>
And receive this error>
- Illegal string offset 'title' in C:\wamp\www\Xenforo5\library\XenForo\Template\Abstract.php(265) : eval()'d code, line 48:
47: <li>
48: <span class="title">' . htmlspecialchars($new['title'], ENT_QUOTES, 'UTF-8') . '</span>
49:
The controller is:
PHP:
$Helper = new Myapp_Helper_News();
$News =
array(
$title = $Helper->getTitle(),
$stitle = $Helper>getSTitle(),
);
$params = $template->getParams();
$hookParams = array(
'news' => $News
And the Helper_News class for this is:
PHP:
public function getTitle()
{
for ($i = 0; $i < 5; $i++) {
$text = $this->news[$i]->title;
}
return $text;
}
I want to load last 5 News from json file.
Api structure is
results->channel->item->news[0]
Thanks for helping undestand this problem.
Regards.