1
Dave_L
Hardcode module directory names?
  • 2005/4/7 12:50

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


This was posted by "banned" in a QA forum thread. I'm reposting it here for open discussion.

Quote:
Hi there,
I've added a new paragraph on the wiki in the dev site.

Quote:
Use of the $xoopsModule->getVar('dirname')
Don't hardcode your module dirname in your php files and templates. We can translate the module content, if you use this we can translate the module name too with a small change in the module's xoops_version.php (E.G. An Italian website doesn't needs a wordbook module, but it needs a 'dizionario' one)
Since XOOPS v. 2.0.10 a new smarty var is added in the core, <{$xoops_dirname}>, that return the module dirname so you can use this in your templates - if an absolute path is needed.


What do you think about this?

banned

2
Dave_L
Re: Hardcode module directory names?
  • 2005/4/7 13:02

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


A couple of comments:

1) Is it really a good idea to translate directory names to different languages? I think that could cause some confusion.

2) Some places in which the module directory name occurs are difficult to make dynamic, such as in constant names, template variable names and template file names. Examples (from the chess module):

constant namedefined('_MD_CHESS_PLAYER_NAME''Player name');
template variable name: <{$chess_player_name}>
template file namechess_game_board.html

Login

Who's Online

320 user(s) are online (190 user(s) are browsing Support Forums)


Members: 0


Guests: 320


more...

Donat-O-Meter

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

Latest GitHub Commits