emiya
Member
Hi,
I want pass an array through the viewparam and I'm asking if there's a better solution for this instead of this what I did:
The thing is that the template is created individually for each upgrade pack, that's why I can't use the <xf:foreach> tag or maybe I can, but I don't know how to solve this properly.
I look forward to your help.
Kind regards
I want pass an array through the viewparam and I'm asking if there's a better solution for this instead of this what I did:
PHP:
$UpgradeFinder = $this->finder('XF:UserUpgrade')
->order('user_upgrade_id', 'asc');
/** @var \XF\Entity\UserUpgrade $upgrades */
$upgrades = $UpgradeFinder->fetch();
$upgrade1 = $upgrades[1];
$upgrade2 = $upgrades[2];
$upgrade3 = $upgrades[3];
$viewParams = [
'costs_1' => $upgrade1['cost_amount'],
'costs_2' => $upgrade2['cost_amount'],
'costs_3' => $upgrade3['cost_amount'],
'title_1' => $upgrade1['title'],
'title_2' => $upgrade2['title'],
'title_3' => $upgrade3['title'],
'descr_1' => $upgrade1['description'],
'descr_2' => $upgrade2['description'],
'descr_3' => $upgrade3['description']
];
The thing is that the template is created individually for each upgrade pack, that's why I can't use the <xf:foreach> tag or maybe I can, but I don't know how to solve this properly.
I look forward to your help.
Kind regards