2014-06-16, 19:24:12
thanks.. it's a this what i want.. but i'm trying to do it without a tpl
i'm get code:
it's working.. i'm get back a all categories what is sorted by date
https://dl.dropboxusercontent.com/u/4998...sort--.jpg.
But all categories is sorted first: by category, seccond by date
it's possible to get only 5 item's from all categories sorted by date..
without a categories. only 5 last added items...
i'm using a functions.php file in template folder
and i'm loading this function by template... it's working..
please help.. thank you in advance
i'm get code:
PHP Code:
// get our controller parameter
global $args;
// get number of items displayed per category
$items_per_cat = isset($args[0]) ? $args[0] : 10;
// define output
$output = '';
// initialize controller
$manager = new ImController();
// get IManager preferences
$preferences = imModel::getPref();
foreach($preferences->categories->category as $cat)
{
// setup items by category
ImCategory::setCategory($cat);
ImModel::setPref('sortby', 'date');
$manager->runModelMethod( 'gen_register',
array('title', 'tresc')
);
$items = array_reverse($manager->getModelValue('items_ordered_struct'));
// ASC
// $items = $manager->getModelValue('items_ordered_struct');
// get number of items per categorie
$item_count = count($items);
$ipc = ($item_count > $items_per_cat) ? $items_per_cat : $item_count;
$row = '';
for($i = 0; $i < $ipc; $i++)
{
$informacja_tytul[$i]= $items[$i]['title'];
$data[$i]= $items[$i]['date'];
$kategoria[$i]= $cat[$i];
$sortuj= $items[$i]['date'];
echo 'kkk ' .$args;
echo 'kategoria: '.$kategoria[$i] . ' '.$informacja_tytul[$i] . ' data: '.$data[$i] . '<br />';
}
}
it's working.. i'm get back a all categories what is sorted by date
https://dl.dropboxusercontent.com/u/4998...sort--.jpg.
But all categories is sorted first: by category, seccond by date
it's possible to get only 5 item's from all categories sorted by date..
without a categories. only 5 last added items...
i'm using a functions.php file in template folder
and i'm loading this function by template... it's working..
please help.. thank you in advance
user plugin: scroll to top