Kategorie-Menü Bild hinzufügen (z.B. "Neu"), wenn ein Artikel in Kategorie, der neuer als 2 Tage
In Override von mod_menu/.../default_component.php
$Query = $item->query;
if ($Query['option'] === 'com_content' && $Query['view'] === 'category' && $Catid = (int) $Query['id'])
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select($db->qn('created'))
->from('#__content')
->where($db->qn('state') . ' = 1')
->where($db->qn('catid') . ' = ' . $Catid)
->order($db->qn('created') . ' DESC');
;
$db->setQuery($query);
$lastDate = $db->loadResult();
$lastDate = strtotime($lastDate);
// nicht älter als 2 Tage
$intervall = 2 * 24 * 60 * 60;
if ($lastDate > (time() - $intervall))
{
$item->menu_image = 'images/powered_by.png';
}
}