SMF Shop
SMFShop => Coding => Topic started by: Martin on January 29, 2007, 07:42:24 pm
-
Okay, here's what I've done:
(http://img258.imageshack.us/img258/1411/userstatsni3.png)
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?
-
Sorry for the double post but can anyone tell me how? I still haven't figured out :-\
-
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..)
-
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:
$modSettings['shopCurrencyPrefix'] . $context['user']['money'] . $modSettings['shopCurrencySuffix']
Hope this helps you :)
-
Well, here's my current faulty code:
// 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.
-
This topic is still unresolved :( lol
-
Firstly, the $txt[''] will be causing heaps of errors (check your error log!). Change this:
', 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:
', 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)
-
GREAT! That works, thanks a lot :D