How to fix your template to add css-class-suffix

You are probably using a 3rd party template which uses a module-override which is not parsing the module css-class-suffix properly. Templates by YOOtheme and some Artiseer templates seem to have this issue. What some templates do wrong is that they totally ignore the css-class-suffix as set in the module configuration (try it!).

The fixes underneath will basically add the suffix to the style, and giving frontend-developers control back over style.

   

Artiseer

Different versions of Artiseer produce different types of module-overrides. So you need to check with which version of Artiseer the template is made, and do the alteration(s) for that version to make the template stop ignoring any extra css-class-suffix.

Templates made with:

Find out which version the template is made with.

 

Artiseer version 2.5

 

file: /templates/template_name/html/modules.php

line 11

if (in_array($sfx, array('art-nostyle', 'art-block', 'art-article')))
    $style = $sfx;
  switch ($style) {
    case 'art-block':
      modChrome_artblock($module, $params, $attribs);
      break;
    case 'art-article':
      modChrome_artarticle($module, $params, $attribs);
      break;
    case 'art-nostyle':
      modChrome_artnostyle($module, $params, $attribs);
      break;
  }

replace with

//if (in_array($sfx, array('art-nostyle', 'art-block', 'art-article')))
  // $style = $sfx;
   
    //make artiseer consider more then one classname    
    $styles = array('art-nostyle', 'art-block', 'art-article');
    for($n = 0; $n < count($styles); $n++){              
        $style_length = strlen($styles[$n]);
        $style_temp = substr($styles[$n], 1, $style_length);            
        if(strpos($sfx, $style_temp)){
            $style = $style;
            break;
        }    
    }
    
  switch ($style) {
    case 'art-block':
      //modChrome_artblock($module, $params, $attribs);
      modChrome_artblock($module, $params, $attribs, $sfx);
      break;
    case 'art-article':
      //modChrome_artarticle($module, $params, $attribs);    
      break;
    case 'art-nostyle':
      //modChrome_artnostyle($module, $params, $attribs);
      modChrome_artnostyle($module, $params, $attribs, $sfx);
      break;
  }

 

AND

line 41

function modChrome_artnostyle($module, &$params, &$attribs)
{
if (!empty ($module->content)) : ?>
<div class="art-nostyle">


<h3> </h3>





<div class="art-nostyle <?php echo $sfx;?>">
<?php if ($module->showtitle != 0) : ?>
<h3><?php echo $module->title; ?></h3>
<?php endif; ?>
<?php echo $module->content; ?>
</div>
<?php endif;
}

function modChrome_artblock($module, &$params, &$attribs, $sfx)
{
  if (!empty ($module->content))
    echo artxBlock(($module->showtitle != 0) ? $module->title : '', $module->content, $sfx);
}

AND

file: /templates/template_name/functions.php

line 134

function artxBlock($caption, $content)

replace with

//function artxBlock($caption, $content)
    function artxBlock($caption, $content, $sfx)

AND

line 145

<div class="art-Block">

replace with

<!--<div class="art-Block">-->
<?php echo '<div class="art-Block '.$sfx.'">'; ?>



Artiseer version 2.4

 

file: /templates/template_name/html/modules.php

(about line 17)
if (in_array($sfx, array_keys($styles)))
    $style = $sfx;
  call_user_func($styles[$style], $module, $params, $attribs);

replace by:

//if (in_array($sfx, array_keys($styles)))
    //$style = $sfx;
    //call_user_func($styles[$style], $module, $params, $attribs);
    //make artiseer consider more then one classname    
    for($n = 0; $n < count($styles); $n++){
        $style = each($styles);
        $style= $style['key'];        
        $style_length = strlen($style);
        $style_temp = substr($style, 1, $style_length);            
        if(strpos($sfx, $style_temp)){            
            call_user_func($styles[$style], $module, $params, $attribs);
            break;
        }    
    }

AND

(about line 34)

function modChrome_artblock($module, &$params, &$attribs)
 {
      if (!empty ($module->content))      
      echo artxBlock(($module->showtitle != 0) ? $module->title : '', $module->content);
 }

replace by:

function modChrome_artblock($module, &$params, &$attribs)
 {
   if (!empty ($module->content))    
     echo artxBlock(($module->showtitle != 0) ? $module->title : '', $module->content, $params->get('moduleclass_sfx'));
 }

AND

(about line 25)

<div class="art-nostyle">

change to:

<?php echo '<div class="art-nostyle '.$sfx.'">'; ?>

AND

(about line 46)

echo artxVMenuBlock(($module->showtitle != 0) ? $module->title : '', $module->content);

change to:

echo artxVMenuBlock(($module->showtitle != 0) ? $module->title : '', $module->content, $params->get('moduleclass_sfx'));

AND

(about line 48)

echo artxBlock(($module->showtitle != 0) ? $module->title : '', $module->content);

change to:

echo artxBlock(($module->showtitle != 0) ? $module->title : '', $module->content, $params->get('moduleclass_sfx'));

AND

file: /templates/template_name/functions.php

find this code:

function artxBlock($caption, $content)

replace by:

function artxBlock($caption, $content, $sfx)

AND

(in the same file a few lines under that)

<div class="art-Block">

replace by:

<?php echo '<div class="art-Block '.$sfx.'">'; ?>

AND

file: /templates/template_name/html/mod_mainmenu/default.php

line 137:

} else if ($params->get('moduleclass_sfx') == 'art-vmenu') {

change to

//} else if ($params->get('moduleclass_sfx') == 'art-vmenu') {
} else if (strpos($params->get('moduleclass_sfx'), 'rt-vmenu')) {   





Artiseer version lower then 2.4

 

file: /templates/template_name/html/modules.php


find this line:

<div class="Block">

change to:

<?php echo '<div class="Block '.$sfx.'">'; ?>

That should make the hiding of modules work.



Find out which version of Artiseer a template has been made

  1. open file: /templates/template_name/html/modules.php
  2. search for this code around line 33:
    $classes = ' ' . $parts[1];

    if the code is in there the template seems to be made with version 3. No alterations are needed!
  3. search for this code around line 11:
    if (in_array($sfx, array('art-nostyle', 'art-block', 'art-article')))

    if the code is in there the template seems to be made with version 2.5. Alterations.
  4. search for this code around line 17:
    if (in_array($sfx, array_keys($styles)))

    if the code is in there the template seems to be made with version 2.4. Alterations.
  5. search for this code:
    <div class="Block">

    if the code is in there the template seems to be made with a version lower then 2.4. Alterations.
  6. If you can't find any of these codes, please contact us. We will help you fix your template.

 



   

Joomlart

Joomlart templates do not have this issue.
   

JoomSpirit

file: /templates/template_name/html/modules.php

try find this line. IT IS IN THERE 2 TIMES:

<div class="">


change it on both places to:
<div class="
">
 <?php if ($showtitle) : ?>

AND

try find this line:

<div class="">
 <div class="module ">

change to:
<div class="
">
 <div class="module ">

   

Rockettheme

Rockettheme templates do not have this issue.
   

Shape5

Shape5 templates don't need alteration.
   

YooTheme

Yootheme template's come in 3 flavours, with the Warp-framework, without the Warp-framework and the evolution-template.
To check if your template uses the Warp-framework check if this file exists in your site:
templates/template_name/layouts/module.php
If the above file exists, your template uses the Warp-framework. If the file does not exist in your site, your template is not using the Warp-framework.

In templates NOT using YOOtheme's Warp CMS theme framework:

file: templates\template_name\html\modules.php
somewhere at the bottom of the code:

$file =  dirname(dirname(__FILE__))."/lib/modules/{$template}.php";


replace with:
if($template!='default'){
 $style = $style.' '.$suffix;
 }
 $file = dirname(dirname(__FILE__))."/lib/modules/{$template}.php";

 

In templates using YOOtheme's Warp CMS theme framework:

file: templates/template_name/layouts/module.php

line: 164 ( or somewhere at bottom of the code)

// render module template
 
 echo $this->render("modules/{$template}", compact('style', 'color',  'yootools', 'first', 'last', 'badge', 'showtitle', 'title', 'content',  'dropdownwidth'));

replace with:

//include the css-class-suffix
$style .=  ' '.$params['suffix'];

// render module template
if($position=='menu'){
    echo '<div class=" frontend_user_access_module_hide_'.$id.'_">';
}
echo $this->render("modules/{$template}", compact('style', 'color', 'yootools', 'first', 'last', 'badge', 'showtitle', 'title', 'content', 'dropdownwidth'));
if($position=='menu'){
    echo '</div>';
}

If you are using the Corona-template also change this code:

line: 39

if ($suffix == 'menu' || $suffix == '_menu') $style = 'menu';

replace with:

if ($suffix == 'menu' || $suffix == '_menu') $style = 'menu';

// consider more then one classname
if(strpos($suffix, 'menu ')){
    $style = 'menu';
}
if(strpos($suffix, 'blank ')){
    $style = 'blank';
}

 

In the Evolution-template

file: templates/yoo_evolution/html/module.php

line: 23

$suffix = $params->get('moduleclass_sfx', '');

replace with:

$suffix    = $params->get('moduleclass_sfx', '');
    
    //workaround to make YooTheme work with more then just one suffix class name
    $suffix_array = explode(' ', $suffix);
    $rest_of_suffix = '';
    if(isset($suffix_array[0])){        
        $suffix = $suffix_array[0];
        $rest_of_suffix = str_replace($suffix, ' ', $params->get('moduleclass_sfx', ''));
    }

AND

// output module
    switch ($skeleton) {

replace with

//make the suffix complete again
    $suffix = $suffix.$rest_of_suffix;

    // output module
    switch ($skeleton) {

   
 
Follow Us On Twitter