RSS Feed/News Using keyed array in template

Status
Not open for further replies.

ENXF NET

Administrator
Staff member
Administrator
Moderator
+Lifetime VIP+
S.V.I.P.S Member
S.V.I.P Member
V.I.P Member
Collaborate
Registered
Joined
Nov 13, 2018
Messages
20,433
Points
823

Reputation:

My controller has this:

PHP:

Code:
$colors = ['30' => 'blue', '55' => 'green'];

$viewParams = [
    'colors' => $colors,
    'entity1' => $entity1,
    'entity2' => $entity2
];

return $this->view('ASP\Foo:bar', 'asp_foo_bar', $viewParams);

And my template has this
HTML:

Code:
<xf:comment>
    {$entity1.sys_id} --> this prints 30
    {$entity2.sys_id} --> this prints 55
</xf:comment>

So basically, what I'm trying to achieve is PHP's equivalent of the following inside the template:
PHP:

$bgcolor1 =...

Read more

Continue reading...
 
Status
Not open for further replies.
Top