Elxis CMS Forum
Extensions => Modules => Topic started by: muharihar on January 16, 2009, 03:51:08
-
hi guys....
I want to load elxis modul from Front End Template by ID.
But i don't know how to write the code.
Any one can help me...?
thanks....
-
forget for my firts post. :P
i'm try to make a copy and then modified function elxLoadModule (file: includes/frontend.php, line: 156)
ori:
function elxLoadModule($name='', $style=-1 ) {
global $mainframe, $database, $my, $lang, $Itemid;
$tp = intval(mosGetParam($_GET, 'tp', 0));
if ($tp) {
echo '<div style="height:50px;background-color:#eeeeee;margin:2px;padding:10px;border:1px solid #f00;color:#700;">'.$name.'</div>'._LEND;
return;
}
$style = intval( $style );
$cache = mosCache::getCache('com_content');
require_once($mainframe->getCfg('absolute_path').'/includes/frontend.html.php' );
$query = "SELECT id, title, module, position, content, showtitle, params, language FROM #__modules"
."\n WHERE module='".$name."' AND published='1' AND access IN (".$my->allowed.") AND client_id='0'"
."\n AND ((language IS NULL) OR (language LIKE '%".$lang."%'))";
$database->setQuery($query, '#__', 1, 0);
if (!$database->loadObject($module)) { return; }
$module = elxTransModTitle($module);
$params = new mosParameters( $module->params );
if ((substr($module->module,0,4))=='mod_') {
if (($params->get('cache') == 1) && ($mainframe->getCfg('caching') == 1)) {
$cache->call('modules_html::module2', $module, $params, $Itemid, $style );
} else {
modules_html::module2( $module, $params, $Itemid, $style, '1' );
}
} else {
if (($params->get('cache') == 1) && ($mainframe->getCfg('caching') == 1)) {
$cache->call('modules_html::module', $module, $params, $Itemid, $style );
} else {
modules_html::module( $module, $params, $Itemid, $style );
}
}
}
copy:
function elxLoadModuleByID( $id='', $style=-1 ) {
global $mainframe, $database, $my, $lang, $Itemid;
$tp = intval(mosGetParam($_GET, 'tp', 0));
if ($tp) {
echo '<div style="height:50px;background-color:#eeeeee;margin:2px;padding:10px;border:1px solid #f00;color:#700;">'.$name.'</div>'._LEND;
return;
}
$style = intval( $style );
$cache = mosCache::getCache('com_content');
require_once($mainframe->getCfg('absolute_path').'/includes/frontend.html.php' );
$query = "SELECT id, title, module, position, content, showtitle, params, language FROM #__modules"
."\n WHERE id='".$id."' AND published='1' AND access IN (".$my->allowed.") AND client_id='0'"
."\n AND ((language IS NULL) OR (language LIKE '%".$lang."%'))";
$database->setQuery($query, '#__', 1, 0);
if (!$database->loadObject($module)) { return; }
$module = elxTransModTitle($module);
$params = new mosParameters( $module->params );
if ((substr($module->module,0,4))=='mod_') {
if (($params->get('cache') == 1) && ($mainframe->getCfg('caching') == 1)) {
$cache->call('modules_html::module2', $module, $params, $Itemid, $style );
} else {
modules_html::module2( $module, $params, $Itemid, $style, '1' );
}
} else {
if (($params->get('cache') == 1) && ($mainframe->getCfg('caching') == 1)) {
$cache->call('modules_html::module', $module, $params, $Itemid, $style );
} else {
modules_html::module( $module, $params, $Itemid, $style );
}
}
}
-
make the "ID" lowercase
ID='".$id."'
-
lowercase done! ;D
thanks Datahell...