Kunena 6.3.0 released

The Kunena team has announce the arrival of Kunena 6.3.0 [K 6.3.0] in stable which is now available for download as a native Joomla extension for J! 4.4.x/5.0.x/5.1.x. This version addresses most of the issues that were discovered in K 6.2 and issues discovered during the last development stages of K 6.3

This is for users to help other users, to discuss topics that are related to forum administration in general or problems in running Joomla. This is not the place to ask for Joomla support. If you want assistance with Joomla please ask at forum.joomla.org

Question count module condition inside function

More
11 years 8 months ago - 11 years 8 months ago #1 by raryan
I am using this code in my joomla template for module block genaration,
this code call for below function;

module("top-col-", "1,2,3")

function module( $prefix, $comma_seperated_suffixes ) {
foreach( (array)explode( ",", $comma_seperated_suffixes ) as $suffix ) {
$module_name = $prefix.trim($suffix);
module_block( $module_name );
}
}

function module_block($jdoc_name) {
if(count(JModuleHelper::getModules($jdoc_name))) {
//this will hide this block if it is not active
?>
<div id="<?php echo $jdoc_name; ?>" class="columns">
<jdoc:include type="modules" name="<?php echo $jdoc_name; ?>" style="html5" />
</div>
<?php
}
}

I want below code to insert into the function, but where. My mind not working. I am giving the example code below:

$module_name_block = (int)(count(JModuleHelper::getModules($jdoc_name)) > 0);

the above code will check for the published modules by taking module name from function, and then
count modules and get a class:

$CountModules = get all module here
if ($CountModules) : $Class = 'count-' . $CountModules;
endif;

automatically see which modules are published and count how many. this code must be inside my function
Last edit: 11 years 8 months ago by raryan.

Please Log in or Create an account to join the conversation.

Time to create page: 0.499 seconds