I know how I can retrieve all information from a article in the database. I am trying to do the same thing for a category. And just for clarification, I am talking about when view is equal to category (index.php?option=com_content&view=category). Below is how I can retrieve any information for a article, when I am on a article page, I want to do the same exact thing, but when I am on a category page. Thanks!
$input = JFactory::getApplication()->input;
$articleId = $input->getInt('id');
$article = JTable::getInstance('content');
$article->load($articleId);
$articleTitle = $article->get('title');
You can check if the view is currently on
category
by using the following:You will see that I'm also checking for the
option
(component in use) as other components use a category view.