Author Topic: Display amount of your money in the News Box (Stats box for me)?  (Read 4638 times)

Offline Martin

Okay, here's what I've done:

It all works fine, it displays the money there but the problem is that it displays only in the shop and in the admin cp. On the main page and everywhere else it's just blank, what should I do to make it work on every page?
« Last Edit: January 31, 2007, 06:17:40 am by MartinD2 »

Offline Martin

Display amount of your money in the News Box (Stats box for me)?
« Reply #1 on: January 31, 2007, 06:16:54 am »
Sorry for the double post but can anyone tell me how? I still haven't figured out  :-\

Offline Martin

Re: Display amount of your money in the News Box (Stats box for me)?
« Reply #2 on: February 03, 2007, 08:21:57 am »
Hmm, I guess no one can help then, it's been days...I've tried many ways, but none of them is successful.. (Sorry for this whole double and tripleposting..)

Offline Daniel15

Re: Display amount of your money in the News Box (Stats box for me)?
« Reply #3 on: February 03, 2007, 08:47:39 am »
Sorry, I've been very busy (just started school again).
Are you using formatMoney()? formatMoney only works if you're inside the shop. Elsewhere, you'll need to do something like:
Code: [Select]
$modSettings['shopCurrencyPrefix'] . $context['user']['money'] . $modSettings['shopCurrencySuffix']
Hope this helps you :)
« Last Edit: February 03, 2007, 08:50:40 am by Daniel15 »

Offline Martin

Re: Display amount of your money in the News Box (Stats box for me)?
« Reply #4 on: February 03, 2007, 08:52:12 am »
Well, here's my current faulty code:

Code: [Select]
// User Statistics
if (!empty($settings['enable_news']))
echo '
<div class="headertitles" style="width: 260px;"><img src="', $settings['images_url'], '/blank.gif" height="12" alt="" /></div>
<div class="headerbodies" style="width: 260px; position: relative; background-image: url(', $settings['images_url'], '/box_bg.gif); margin-bottom: 8px;">
<img src="', $settings['images_url'], '/', $context['user']['language'], '/newsbox.gif" style="position: absolute; left: -1px; top: -16px;" alt="" />
<div style="height: 50px; overflow: auto; padding: 5px;" class="smalltext">

', sprintf($txt['userareahave'], ($context['user']['money'])),
($modSettings['shopBankEnabled'] ? sprintf($txt[''],
  ($context['user']['moneyBank'])) : ''), '
  <br>
 
', sprintf($txt[''], ($context['user']['money'])),
($modSettings['shopBankEnabled'] ? sprintf($txt['userareahave2'],
  ($context['user']['moneyBank'])) : ''), '


</div>
</div>';

I know, laugh as much as you want, I ain't that smart at PHP but usually I get stuff I need, done.

Offline Martin

Re: Display amount of your money in the News Box (Stats box for me)?
« Reply #5 on: February 10, 2007, 10:17:10 am »
This topic is still unresolved :( lol

Offline Daniel15

Re: Display amount of your money in the News Box (Stats box for me)?
« Reply #6 on: February 10, 2007, 12:58:48 pm »
Firstly, the $txt[''] will be causing heaps of errors (check your error log!). Change this:
Code: [Select]
', sprintf($txt['userareahave'], ($context['user']['money'])),
($modSettings['shopBankEnabled'] ? sprintf($txt[''],
  ($context['user']['moneyBank'])) : ''), '
  <br>
 
', sprintf($txt[''], ($context['user']['money'])),
($modSettings['shopBankEnabled'] ? sprintf($txt['userareahave2'],
  ($context['user']['moneyBank'])) : ''), '

into this:
Code: [Select]
', sprintf($txt['userareahave'], ($context['user']['money'])), '<br />
', ($modSettings['shopBankEnabled'] ? sprintf($txt['userareahave2'], ($context['user']['moneyBank'])) : ''), '

Secondly, make sure that $txt['userareahave'] and $txt['userareahave2'] are defined in Themes/default/Modifications.english.php. If they're in Shop.english.php, it won't work (that file is only loaded when you're in the shop)

Offline Martin

Re: Display amount of your money in the News Box (Stats box for me)?
« Reply #7 on: February 10, 2007, 01:35:51 pm »
GREAT! That works, thanks a lot :D