Design Meets Code

WordPress – Drupal – Prestashop

Aktive CMS Klasse für Prestashop

| Keine Kommentare

Open classes/FrontController.php
Find the function displayHeader()

After this

‘logo_image_height’ => Configuration::get(‘SHOP_LOGO_HEIGHT’),
‘priceDisplayPrecision’ => _PS_PRICE_DISPLAY_PRECISION_,
‘content_only’ => (int)Tools::getValue(‘content_only’),

Add this line of code

‘cms_class’ =>(int)Tools::getValue(‘id_cms’)

Open Header.tpl
add in the body tag this line of code {if $page_name ==’cms’} class=”cms{$cms_class}”{/if}
like this

What we did so far is take the cms ID and add a class to the body tag.
Now we need to add a class to the LI from the cms links, so we can make a css rule.

Open blockcms.php

find the function getCMStitles().
go to this line

{
$row['link'] = $link->getCMSLink((int)($row['id_cms']), $row['link_rewrite']);
$links[] = $row;
}

Change it like this.

{
$row['link'] = $link->getCMSLink((int)($row['id_cms']), $row['link_rewrite']);
$row['id_s'] = $row['id_cms'];
$links[] = $row;
}

Now open Blockcms.tpl and add to the li a class

{if isset($cms_page.link)}

  • And now use the css like this ….
    body.cms_class1 li.clink1 a { ***The desired css rule for active page*****}

  • Hinterlasse eine Antwort

    Pflichtfelder sind mit * markiert.

    *