66
Quote:
Draven wrote:
Quote:
Quote:Having this allows you to theme differently for each module
It's already there !
Check <{$module.directory}> and <{$module.name}>
Also, theme writers may want to try "Smarty debug" mode in PHP or insert <{debug}> in their templates to see all the defined variables.
See!! I went and made my own hack cause I had no clue it was there. Are you sure it was there in 2.0.3? I swear I did a smarty debug on each module looking for any current variables I could use and saw none. Is it possible this was only added in 2.0.5 after sending my hacks to Catz?
Skap,
I tried both of these out and it won't work. If you're on the Home page or any "system" module it says the last module active, in my case it always says IPBoard even it you're on the home page. Sorry bro.
Here's the hack I was using in the mainfile.php
// Added to identify Current Module
$module_handler =& xoops_gethandler('module');
$installed_mods =& $module_handler->getObjects();
foreach ( $installed_mods as $module) {
$listed_mods[] = $module->getVar('dirname');
}
$c = "0";
//print($xoopsRequestUri);
foreach($listed_mods as $mod){
// check to see if the Uri matches a loaded module.
$pos = strpos($xoopsRequestUri, $mod);
if(!$pos === false){
$_SESSION["c_module"] = $mod;
$c = 1;
$isHome = 0;
}
}
if($c == 0){
// We must be in a system module
$_SESSION["c_module"] = "system";
// Are we viewing the homepage?
if(strpos($xoopsRequestUri, "index") || $xoopsRequestUri == "/"){
$isHome = 1;
}
}
It's not pretty but it tells me what module is currently being viewed and if one isn't found (homepage or edituser.php) it labels it "system".
With this variable available in my templates I can then assign dynamic style sheets by using:
Then I can have a different style sheet for each module stored in my themes folder.
Also allows for different images by doing:
This allows me to create image folders in my themes that hold different colors and/or images based on modules.