1
marcan
Soapbox tiny little harcoded text
  • 2004/2/25 20:50

  • marcan

  • Just can't stay away

  • Posts: 824

  • Since: 2003/10/8


In the great module Soapbox, I've found a tiny little word harcoded in a template file.

The heading of a column in the index page of Soapbox, there's the name of the author that is written like this: "By authorname".

The "By" is hardcoded in the template. I know that this is not significant but I just want to know if this is teh good way to solve this.

Here is what I did :

in Index.php, I added this line around line 46 :

Quote:
$xoopsTpl->assign('lang_byauthor',_MD_SB_BYAUTHOR);

In templates/sb_index.html, I change the line 14 from this :
Quote:
By <{$columna.authorname}>

To this :
Quote:
<{$lang_byauthor}> <{$columna.authorname}>

In Language/englishmain.php, I added this constant :
Quote:
define("_MD_SB_BYAUTHOR", "By");

Did the same thing with the other languages I use.

I performed an update of the module.

Since I'm pretty newbie in playing with module, could someone tell me if this is the good way to do this?

2
hsalazar
Re: Soapbox tiny little harcoded text
  • 2004/2/25 21:29

  • hsalazar

  • Just popping in

  • Posts: 78

  • Since: 2003/2/6 1


Marc-André:

You're right on! And since one of the founding purposes of SOapbox was to serve as a lab and testing ground to teach the building of a module, it's accomplished its purpose even unknowingly!

Cheers.

3
Mithrandir
Re: Soapbox tiny little harcoded text

Language constants *should* be available in smarty templates simply through <{$smarty.const._CONST_NAME}>

but for some reason I have had problems with this approach - and it seems to be a common procedure to assign a variable with the value of the language constant and use that variable in the template.

4
hsalazar
Re: Soapbox tiny little harcoded text
  • 2004/2/25 21:53

  • hsalazar

  • Just popping in

  • Posts: 78

  • Since: 2003/2/6 1


Mithrandir:

This is something that you rightly emphasize. Of course, we all need some guidance as to how to solve particular issues, and so far I stil haven't seen any modules following this approach. It's obvious we're all in the process of learning.

Cheers.

5
Mithrandir
Re: Soapbox tiny little harcoded text

My server booking module does use it (not released version yet) - and it works. I'll do some more testing as to how to use it.

Login

Who's Online

977 user(s) are online (41 user(s) are browsing Support Forums)


Members: 0


Guests: 977


more...

Donat-O-Meter

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

Latest GitHub Commits