1
equinox
it is possible to extend the "$xoops_dirname" var?
  • 2010/1/17 16:04

  • equinox

  • Just popping in

  • Posts: 13

  • Since: 2010/1/17


Hi Community,

it is possible to extend the "$xoops_dirname" var until a requested page?

Let me give an you an example:

<ul>
 <
li class="<{if $xoops_dirname == myiframe}>active<{/if}>">
  <
a href="<{$xoops_url}>/modules/myiframe/folder/example.html">Examplea>
 li>
ul>


It is possible to include the requested page (*.html) into this condition?

I build a menu in the theme.html where the absolute link is given.
I got 5 links that all been in 1 module. If i style the active-link like you see in the example, that will take the effect to all links are styled as active.

Careful
Thomas

2
ghia
Re: it is possible to extend the "$xoops_dirname" var?
  • 2010/1/17 17:15

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


See this example for changing header photo's on XOOPS.nl

3
kris_fr
Re: it is possible to extend the "$xoops_dirname" var?
  • 2010/1/17 17:35

  • kris_fr

  • Theme Designer

  • Posts: 1009

  • Since: 2005/12/31


hi,

ex. kaifulee theme
<{php}>
$module_list = array(
    
'resource'    => array('resource','how','article','wfdownloads','hope'),
    
'wordpress'    => array('wordpress'),
    
'bbs'       => array('bbs'),
    
'profile'   => array('profile','plan','friends','karma'),
    
'practice'  => array('practice','news','event','webinar','volunteer','xoopspoll'),
);
$xoops_current_module "";
if( !empty(
$this->_tpl_vars["xoops_dirname"]) ) {
    foreach ( 
$module_list as $root => $mod ){
        if( 
in_array($this->_tpl_vars["xoops_dirname"], $mod) ) {
            
$xoops_current_module $root;
            break;
        }
    }
}
$this->assign('xoops_current_module'$xoops_current_module);
<{/
php}>
<
ul id="menu_header">
       <
li class="first">
           <
a href="<{$xoops_url}>"><{$smarty.const._US_HOME}>a>
       li>
    <
li <{if $xoops_current_module eq 'resource'}> class="current"<{/if}> >
        <
a href="<{$xoops_url}>/modules/resource/"><{$smarty.const._US_RESOUCE}>a>
    li>
    <
li <{if $xoops_current_module eq 'wordpress'}> class="current"<{/if}> >
        <
a href="<{$xoops_url}>/modules/wordpress/"><{$smarty.const._US_WORDPRESS}>a>
    li>
    <
li <{if $xoops_current_module eq 'bbs'}> class="current"<{/if}> >
        <
a href="<{$xoops_url}>/modules/bbs/"><{$smarty.const._US_BBS}>a>
    li>
    <
li <{if $xoops_current_module eq 'practice'}> class="current"<{/if}> >
        <
a href="<{$xoops_url}>/modules/practice/"><{$smarty.const._US_PRACTICE}>a>
    li>
    <
li <{if $xoops_current_module eq 'profile'}> class="current"<{/if}> >
        <
a href="<{$xoops_url}>/modules/profile/"><{$smarty.const._US_PROFILE}>a>
    li>
ul>


@+

4
equinox
Re: it is possible to extend the "$xoops_dirname" var?
  • 2010/1/17 21:46

  • equinox

  • Just popping in

  • Posts: 13

  • Since: 2010/1/17


Hi,

thx a lot friends, the problem is solved! Great job!

To do:
place this php-code in the top of your page:
<{php}> 
$pageurl getenv("REQUEST_URI");
 
$GLOBALS['xoopsTpl']->assign'xoops_pageurl'$pageurl);
 <{/
php}>


Then you can use absolute paths to the file of your request.
Example:
<ul>
 <
li class="<{if $xoops_pageurl == "/modules/myiframe/index.php?iframeid=1"}>active<{/if}>">
  <
a href="<{$xoops_url}>/modules/myiframe/index.php?iframeid=1">Examplea>
 li>
ul>


@ghia: thx for your great link.
@kris_fr: thx for your answer, but the working possibility from ghia is very lightweighter.

greez from Germany
Thomas

Login

Who's Online

371 user(s) are online (247 user(s) are browsing Support Forums)


Members: 0


Guests: 371


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