99 Posts
SimonD
7 years ago
3
Topic

Hello,

In your Joomla! template you can get some informations about the active page and use them as css class inside the html or the body tag.

For example:

$app = JFactory::getApplication();

$menu = $app->getMenu();

$active = $menu->getActive();

$itemid = $active->id;

and

I would like to use this sytem to style differently a seblod list page (displayed from a Seblod list menu) and an item page, displayed after you click on a link/content/view (n°2), from the list view.

For me this it would be a good solution:

- no need to create another template

- no need to create menu link to your item

The problem is that all the active page parameters available seem to exactly the same in the list page and in the item page (you can display them with

<?php print_r($active); ?> ).

Any idea ?

Thank you

Simon

Get a VIP membership
99 Posts
SimonD
7 years ago
0
Level 1

Hello,

I've found a workaround:

In my template (main Joomla! template not Seblod template), I've added a call to the pagination parameter:

$pagination = $params->get('pagination');

and in my body tag:

<body class="some_class<?php ($pagination ? (' list') : (' item')); ?>">

So on a Seblod list page I have <body class="some_calss list"> and on an item page I have <body class="some_class item"> because there is no paginitation parameter for a list item (a content type or an article).

What do you think ?

Regards

4229 Posts
Kadministrator
7 years ago
1
Level 1

Item page is displayed inside joomla com_content so you can easily differentiate them by checking value of the option url parameter

99 Posts
SimonD
7 years ago
0
Level 2

Hello Klas,

$jinput = JFactory::getApplication()->input;

$option = $jinput->get('option');

$option = com_cck for list view

$option = com_content for item view

Thank you for your help

Simon

Get a VIP membership