Dannymh
Active member
I have an email template and I am passing in an array that is sliced from a finder array.
When I then try to loop through that in an email template it isn't giving me the values.
My array has values that are returned from the finder
If I loop through these on the cron I can list out the values with something like
but if I pass it in to my email template as a variable
It just returns the dash in the text and not the array
Any thoughts on what might be happening?
When I then try to loop through that in an email template it isn't giving me the values.
HTML:
<xf:if is="$totalBidders > 0">
<h2>High Bidders</h2>
<xf:foreach loop="$bidders" value="$bidr">
<a href={{ link('members', $bidr) . '#about' }}>{$bidr.User.username}</a> - {$bidr.User.email}
</xf:foreach>
</xf:if>
My array has values that are returned from the finder
PHP:
$app = \XF::app();
$user = $app->em()->find('XF:User', $lot->user_id);
$bidders = \XF::finder('ledger:Bids')
->where('thread_id', '=', $lot->thread_id)
->with('User')
->with('Thread')
->order('bid_time', 'ASC'
->fetch();
If I loop through these on the cron I can list out the values with something like
PHP:
foreach($bidders as $bdr)
{
echo $bdr->User->username;
}
but if I pass it in to my email template as a variable
PHP:
$mail->setToUser($user)
->setTo($user->email, $lot->username)
->setTemplate('pass_on', [
'bidders' => $bidders
]);
It just returns the dash in the text and not the array
Any thoughts on what might be happening?
Last edited: