View Single Post
Old 08.12.2005, 14:39   #6 (permalink)
vajinder
Baby Mamber
 
Join Date: Dec 2005
Posts: 1
vajinder is on a distinguished road
Default Re: Modules to display on only one page

/*
Copy the following function in "/includes/frontend.php" after mosLoadModules() function.
And in the page where you want to display only one module, use "mosLoadModulesVj("top",1,$module_id)" instead of mosLoadModules() and provide $module_id in this function.
*/
////////////////////////////////
function mosLoadModulesVj( $position='left', $style=0 ,$loaderid) {
global $mosConfig_gzip, $mosConfig_absolute_path, $database, $my, $Itemid, $mosConfig_caching;

$tp = mosGetParam( $_GET, 'tp', 0 );
if ($tp) {
echo '<div style="height:50px;background-color:#eee;margin:2px;padding:10px;border:1px solid #f00;color:#700;">';
echo $position;
echo '</div>';
return;
}
$style = intval( $style );
$cache =& mosCache::getCache( 'com_content' );

require_once( $mosConfig_absolute_path . '/includes/frontend.html.php' );

$allModules =& initModules();
if (isset( $GLOBALS['_MOS_MODULES'][$position] )) {
$modules = $GLOBALS['_MOS_MODULES'][$position];
} else {
$modules = array();
}


if (count( $modules ) < 1) {
$style = 0;
}
if ($style == 1) {
echo "<table cellspacing=\"1\" cellpadding=\"0\" border=\"0\" width=\"100%\">\n";
echo "<tr>\n";
}
$prepend = ($style == 1) ? "<td valign=\"top\">\n" : '';
$postpend = ($style == 1) ? "</td>\n" : '';

$count = 1;
foreach ($modules as $module) {
if($module->id==$loaderid)
{
$params = new mosParameters( $module->params );

echo $prepend;

if ((substr("$module->module",0,4))=="mod_") {
if ($params->get('cache') == 1 && $mosConfig_caching == 1) {
$cache->call('modules_html::module2', $module, $params, $Itemid, $style );
} else {
modules_html::module2( $module, $params, $Itemid, $style, $count );
}
} else {
if ($params->get('cache') == 1 && $mosConfig_caching == 1) {
$cache->call('modules_html::module', $module, $params, $Itemid, $style );
} else {
modules_html::module( $module, $params, $Itemid, $style );
}
}

echo $postpend;
$count++;
}
}
if ($style == 1) {
echo "</tr>\n</table>\n";
}
}
////////////////////////////////
vajinder is offline   Reply With Quote