1

I'm trying to get the category id's of a site listing multiple featured articles. JFactory::getApplication()->input->getInt('catid'); works fine if the site contains just an article.

Is there something similar for featured articles?

Thanks in advance!

1 Answer 1

2

You will not get it from the input, because the categories are not set into the request for featured view.

What you can do is to use the parameters of active menu item to retrieve them. Like this:

$activeMenu = JFactory::getApplication()->getMenu()->getActive();
$categories = $activeMenu->params->get('featured_categories');
var_dump($categories);

The result is an array with categories ids:

array(2) 
{ 
    [0]=> string(2) "19" 
    [1]=> string(2) "20" 
}
1
  • Sorry for the late reply. This works perfect!
    – Rikan
    Jan 30, 2015 at 9:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.