2018-09-19, 21:25:24
Hey Bigin, it's me again
i want to pick the latest 4 items from a category. currently i doin it "static" what means: if i add a new entry into my category, the latest item will not be shown on my page cause the $count is already at its limit. do you know what i mean? Here is my code so far:
<?php
$count = "1";
$imanager = imanager();
$mapper = $imanager->getItemMapper();
// change 1 to your category id
$mapper->alloc(1);
foreach($mapper->simpleItems as $item) {
if($count > 4) break;
echo '
<div class="box20 angebot">
<div class="angebot-bild">
<img src="'.IM_SITE_URL.$item->bild[0].'" width="100%">
</div>
<div class="angebot-bauteil">'.$item->bauteil.'</div>
<div class="angebot-bauteil">'.$item->preis.'</div>
</div>
';
$count++;
};
?>
regards
Fab

i want to pick the latest 4 items from a category. currently i doin it "static" what means: if i add a new entry into my category, the latest item will not be shown on my page cause the $count is already at its limit. do you know what i mean? Here is my code so far:
<?php
$count = "1";
$imanager = imanager();
$mapper = $imanager->getItemMapper();
// change 1 to your category id
$mapper->alloc(1);
foreach($mapper->simpleItems as $item) {
if($count > 4) break;
echo '
<div class="box20 angebot">
<div class="angebot-bild">
<img src="'.IM_SITE_URL.$item->bild[0].'" width="100%">
</div>
<div class="angebot-bauteil">'.$item->bauteil.'</div>
<div class="angebot-bauteil">'.$item->preis.'</div>
</div>
';
$count++;
};
?>
regards
Fab