×
Kunena 5.1.5 Released - Security Release (14 Oct 2018)

The Kunena team has announce the arrival of Kunena 5.1.5 [K 5.1.5] which is now available for download as a native Joomla extension for J! 3.8.x. This version addresses most of the issues that were discovered in K 5.1 and issues discovered during the development stages of K 5.1. This is a Security release.

× 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
6 years 2 months ago - 6 years 2 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: 6 years 2 months ago by raryan.

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

  • Not Allowed: to create new topic.
  • Not Allowed: to reply.
  • Not Allowed: to add attachements.
  • Not Allowed: to edit your message.
Time to create page: 0.075 seconds