Answer the question
In order to leave comments, you need to log in
We display a picture from a category on the main page in a block, how to display it by id?
Hello, I'm trying to display on the main page of the site in the block a picture from a category by id, I managed to display all the images of the categories, but how to display from a specific category, exactly from the one I want id 858.
In the template, the code for output:
<?php foreach ($categories as $cat):?>
<img src="/media/uploads/cat/<?=$cat['catimage']?>"/>
<?php endforeach; ?>
$cat_id = 858;
$cats = ORM::factory('category')->where('parent_id', '=', $cat_id)->find_all();
Answer the question
In order to leave comments, you need to log in
So you do this:
<?
print_r($cat);
die();
?>
$val = reset($cats);
echo $val['catimage'];
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question