1

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?

webprogrammer
  • 792
  • 15
  • 26

1 Answers1

0
   $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; 
   ?>
Community
  • 1
  • 1
ares777
  • 3,590
  • 1
  • 22
  • 23
  • I'm sry, but this is not the category I'm searching for! It's the section! In Joomla 2.5 there has been a sectionid in the article-table. In Joomla 3.x there isn't a sectionid. I have to say I upgrade from 1.5 to 2.5 and from 2.5 to 3.x. – webprogrammer Mar 09 '15 at 12:12