Get sectionid from artice Joomla 3

228 views Asked by At

After upgrading from Joomla 2.5 to Joomla 3 my custom module doesn't work anymore. I got some Text from #__sections where my id was in #__content -> sectionid.

So sectionid in #__content is deprecated but I couldn't find any other solution to get the section from a article. Has anyone an idea?

1

There are 1 answers

1
ares777 On
   $input=Jfactory::getApplication()->input;
   if($input->getCmd('option')=='com_content' 
   && $input->getCmd('view')=='article' ){
     $db=JFactory::getDbo(); 
     $db->setQuery('select catid from #__content where id='.$input->getInt('id')); 
     $catid=$db->loadResult(); 
   }

as seen at Get current article category ID in Joomla 3.2

My personal test:

   <?php // Joomla 3.1
   $app = JFactory::getApplication();
   $catID = $app->input->get('cat_id');
   echo $catID; 
   ?>