Search code examples
phpjoomla

How to detect if the page is a Joomla article or category blog view


I would like to apply a class to a div according to a specific view of the page. If the page is a category blog view I want to add the class "blogview" else if the page is an article I want to apply the class "articleview". I would do this in the index.php file of my template. How could I do that?

Thanks in advance.


Solution

  • JRequest is deprecated. Use JFactory::getApplication()->input instead. For example JFactory::getApplication()->input->get('view')

    See: https://docs.joomla.org/Retrieving_request_data_using_JInput