1
maxima
What does this bit of code do?
  • 2006/10/10 14:48

  • maxima

  • Not too shy to talk

  • Posts: 152

  • Since: 2006/3/4 4


Saw this code at the top of theme.html of a theme. What is it doing?
Quote:
<{php}>
$mod = $GLOBALS['xoopsModule'];
$dirname = (isset($mod) ? $mod->getVar('dirname') :'system');
$GLOBALS['xoopsTpl']->assign( 'xoops_cmod', $dirname );
<{/php}>

2
davidl2
Re: What does this bit of code do?
  • 2006/10/10 15:09

  • davidl2

  • XOOPS is my life!

  • Posts: 4843

  • Since: 2003/5/26


According to a very clever colleague of mine:

"it finds the current module's directory name and assigns it to the template engine so it can be used in themes"

Which theme is it from?

3
m0nty
Re: What does this bit of code do?
  • 2006/10/10 15:21

  • m0nty

  • XOOPS is my life!

  • Posts: 3337

  • Since: 2003/10/24


was just abt to say that dave..

essentially it creates a smarty tag that you can use.. <{xoops_cmod}> which displays the directory (module folder) name

4
davidl2
Re: What does this bit of code do?
  • 2006/10/10 15:25

  • davidl2

  • XOOPS is my life!

  • Posts: 4843

  • Since: 2003/5/26


That could be handy... although part of this can be achieved with the templating functions in 2.0.14 onwards I guess?

5
maxima
Re: What does this bit of code do?
  • 2006/10/10 17:37

  • maxima

  • Not too shy to talk

  • Posts: 152

  • Since: 2006/3/4 4


Thanks.

The code was from Astonthemes.com WDC_006

6
tcnet
Re: What does this bit of code do?
  • 2006/10/10 18:41

  • tcnet

  • Friend of XOOPS

  • Posts: 297

  • Since: 2006/5/12


This FAQ by Chapi explains it all.

If you are using XOOPS 2.1.10 or above the code is not needed because the $dirname variable has been added to the core. Before that, this snippet would be added to the theme to create the dirname variable.

Now the smarty variable < { $xoops_dirname } > (without spaces) will call up the directory folder name. It can be used to change themes, banners or titles per module. More Here.

7
davidl2
Re: What does this bit of code do?
  • 2006/10/10 20:57

  • davidl2

  • XOOPS is my life!

  • Posts: 4843

  • Since: 2003/5/26


I'm not sure, but I don't think this is in 2.3 yet... but it'll probably appear in 2.4 (This is a guess..!)

Login

Who's Online

329 user(s) are online (271 user(s) are browsing Support Forums)


Members: 0


Guests: 329


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