1
Cubiq
Module name or directory
  • 2004/11/23 15:19

  • Cubiq

  • Just popping in

  • Posts: 7

  • Since: 2004/11/23


Is there a way to get the module name or module directory (just "news", "newbb", "polls", ecc) to use in Smarty so I can do something like:

<body id="<${MODULE_NAME}>">....


or

<{if $MODULE_NAME == "newbb"}>....<{/if}>


I tried with $xoops_pagetitle but it contains unpredictable contents (such as news title or forum threads title).

Another way would be to check for $xoops_requesturi but the template becomes server-dependent and it is not said that the requesturi is always assigned.

I was thinking about the following solution:

<body id="<{$xoops_pagetitle|truncate:5:""}>">...


or something like that to get the first 5 characters of the page title, but it would be nice to have the variablized module name.

Thanks

2
batdevis
Re: Module name or directory
  • 2005/2/18 9:16

  • batdevis

  • Just popping in

  • Posts: 41

  • Since: 2002/8/16


I have the same problem!

3
Dave_L
Re: Module name or directory
  • 2005/2/18 12:42

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


I don't think the module directory name is in a predefined Smarty variable, so you would have to do that yourself, in the .php file that generates the content for the template:

global $xoopsTpl$xoopsModule// needed if inside a function
$xoopsTpl->assign('xyz_dirname'is_object($xoopsModule) ? $xoopsModule->getVar('dirname') : '');


Then you can use <{$xyz_dirname}> in the template.

4
batdevis
Re: Module name or directory
  • 2005/2/18 14:39

  • batdevis

  • Just popping in

  • Posts: 41

  • Since: 2002/8/16


thank you very much.
I've put it in the footer.php, after the code

if ( !defined("XOOPS_FOOTER_INCLUDED") ) {
    
define("XOOPS_FOOTER_INCLUDED",1);
    
$xoopsLogger->stopTime();
    if (
$xoopsOption['theme_use_smarty'] == 0) {
        
// the old way
        
$footer $xoopsConfigMetaFooter['footer'].'Powered by XOOPS © 2002 The XOOPS Project
';
        if (isset(
$xoopsOption['template_main'])) {
            
$xoopsTpl->xoops_setCaching(0);
            
$xoopsTpl->display('db:'.$xoopsOption['template_main']);
        }
        if (!isset(
$xoopsOption['show_rblock'])) {
            
$xoopsOption['show_rblock'] = 0;
        }
        
themefooter($xoopsOption['show_rblock'], $footer);
        
xoops_footer();
    } else {


so I've always the variable.

5
mouacy
Re: Module name or directory
  • 2005/3/19 3:48

  • mouacy

  • Not too shy to talk

  • Posts: 138

  • Since: 2002/11/2


To use the modulename, you will need to change the

$xoopsTpl->assign('xyz_dirname', is_object($xoopsModule) ? $xoopsModule->getVar('dirname') : ''); to

$xoopsTpl->assign('xyz_dirname', is_object($xoopsModule) ? $xoopsModule->getVar('name') : '');

Login

Who's Online

376 user(s) are online (270 user(s) are browsing Support Forums)


Members: 0


Guests: 376


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits