Subject:*
<
Name/Email:*
<
Message Icon:*
<
Select*
<
Message:*
<



Click the Preview to see the content in action.
Options:*
<
Confirmation Code*
<
4 - 1 = ?  
Input the result from the expression
Maximum attempts you can try: 10
*
<
     
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, , that return the module dirname so you can use this in your templates - if an absolute path is needed.[/quote] What do you think about this? banned[/quote][/quote]" />

Re: Hardcode module directory names?
by Dave_L on 2005/4/7 13:02:26

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):

le="color: #000000"><?php constant name: defined('_MD_CHESS_PLAYER_NAME', 'Player name'); template variable name: <{$chess_player_name}> template file name: chess_game_board.html
Hardcode module directory names?
by Dave_L on 2005/4/7 12:50:07

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

Who's Online

197 user(s) are online (141 user(s) are browsing Support Forums)


Members: 0


Guests: 197


more...

Donat-O-Meter

Stats
Goal: $15.00
Due Date: Jul 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $15.00
Make donations with PayPal!

Latest GitHub Commits