Dr.CustUmz
05-02-2020, 04:38 PM
So I am trying to use a foreach in my plugin and call it in my template with a variable, since my foreach is open it's breaking my product. How can I go about calling a foreach and include it in my template?
My before product, raw php:
<?php
$i=0;
foreach($result as $row) if ($i < 10+1) {
?>
<div id="something">
<div class="really"><b>Cool:</b> <?php echo number_format($row['repeat']);?></div>
</div>
<?php
$i +=1;
}
?>
so I have my plugin like this (and yes the other variables are defined, this is just where the is)
$i=0;
$drc_4ch-st = foreach($result as $row) if ($i < 10+1) {;
$i +=1;
$drc_4ch-ed = };
$drc_rep = number_format($row['repeat']);
and the template like this
$drc_4ch-st
<div id="something">
<div class="really"><b>Cool:</b> $drc_rep</div>
</div>
$drcc_4ch-ed
and it breaks, the variable$drc_repworks on its own, but nothing works when i add the portion above it.
My before product, raw php:
<?php
$i=0;
foreach($result as $row) if ($i < 10+1) {
?>
<div id="something">
<div class="really"><b>Cool:</b> <?php echo number_format($row['repeat']);?></div>
</div>
<?php
$i +=1;
}
?>
so I have my plugin like this (and yes the other variables are defined, this is just where the is)
$i=0;
$drc_4ch-st = foreach($result as $row) if ($i < 10+1) {;
$i +=1;
$drc_4ch-ed = };
$drc_rep = number_format($row['repeat']);
and the template like this
$drc_4ch-st
<div id="something">
<div class="really"><b>Cool:</b> $drc_rep</div>
</div>
$drcc_4ch-ed
and it breaks, the variable$drc_repworks on its own, but nothing works when i add the portion above it.