Customizing SMF > Modifications and Packages

SMFShop- Version 3.2 Now SMF 2.0 Support!

<< < (2/567) > >>

Jerry:
thanks for the update :) I think it may also have given my display.template.php a parse error :-\

codenaught:
Hey great mod! I am just looking for more items in the future as there aren't that many in the first release. So far it looks quite good!  :)

[Unknown]:
From install.xml:
> SET money = money + {$modSettings['shopPointsPerTopic']}
> SET money = money + {$modSettings['shopPointsPerPost']}

I suggest using $modSettings[shopPointsPerTopic], as it will parse ever so very slightly faster.

> $context['admin_areas']['shop'] = array (

You should probably check permissions.  It's possible a moderator could get into this section (and have permission to do other things, but not manage the shop...)

if (allowedTo('shop_admin'))
   $context['admin_areas']['shop'] = array(
...

> "{$txt['shop_admin_items']}"

Erm... why not just $txt['shop_admin_items']?  Forcing interpolation will end up wasting memory.

> echo "dode";

Typo?  Note that this section is only for converting template.php's, so you won't see it active at all.

The $message['member'] array is set in Load.php.  Look for loadMemberData() and loadMemberContext().

> <br><br>

XHTML -> <br /><br />.


--- Code: ---        $newSettings['shopPointsPerTopic'] = $_POST['pertopic'];
        $newSettings['shopPointsPerPost'] = $_POST['perpost'];
--- End code ---

You should probably cast pertopic and perpost to ints, just to make sure they typed numbers... like so:


--- Code: ---        $newSettings['shopPointsPerTopic'] = (int) $_POST['pertopic'];
        $newSettings['shopPointsPerPost'] = (int) $_POST['perpost'];
--- End code ---

I notice you use several different templates, Invision-style.  The general method in SMF is to use one larger template and use sub templates.  For example, you might change this:

    loadTemplate('ShopAdminInventory');

To:

    loadTemplate('ShopAdmin');
    $context['sub_template'] = 'inventory';

And then instead of:

function template_main() {

Use:

function template_inventory() {

You may, from your experience with Invision, prefer the other way - and that's fine, this is of course only a suggestion... but I would say that staying with "the way SMF works" will make things easier for those who use your mod.

And, lastly, db_stuff.php uses smf_ hardcoded.  I strongly suggest you use $db_prefix instead, because this forum, as an example, uses a different prefix than smf_.

And, personally, I might replace this:


--- Code: ---//give admin money :-)
db_query("UPDATE `smf_members` SET `money` = '10000' WHERE `ID_MEMBER` = '1' LIMIT 1", __FILE__, __LINE__);
--- End code ---

With:

--- Code: ---// Reward whoever's installing this with a lot of money :-).
updateMemberData(empty($ID_MEMBER) ? 1 : $ID_MEMBER, array('money' => 10000));
--- End code ---

Don't take these suggestions the wrong way, or anything, I'm just trying to give you some helpful advice on integrating into SMF; I know there are not a whole ton of examples available quite yet.

-[Unknown]

Daniel15:
thanks for your comments [Unknown] ;) Since i have no previous knowledge of modding SMF, most of the code is rough


--- Quote ---The $message['member'] array is set in Load.php.  Look for loadMemberData() and loadMemberContext().

--- End quote ---
Thanks for that.


--- Quote ---I notice you use several different templates, Invision-style.  The general method in SMF is to use one larger template and use sub templates.  For example, you might change this:

    loadTemplate('ShopAdminInventory');

To:

    loadTemplate('ShopAdmin');
    $context['sub_template'] = 'inventory';

And then instead of:

function template_main() {

Use:

function template_inventory() {

You may, from your experience with Invision, prefer the other way - and that's fine, this is of course only a suggestion... but I would say that staying with "the way SMF works" will make things easier for those who use your mod.

--- End quote ---

i've never actually looked through the code of Invision Board MODS, i was just guessing that's how to do templates... i'll fix that in the next version


--- Quote ---And, lastly, db_stuff.php uses smf_ hardcoded.  I strongly suggest you use $db_prefix instead, because this forum, as an example, uses a different prefix than smf_.

--- End quote ---
I was going to do that, but then i forgot to... I just grabbed the database stuff using phpMyAdmin, and dumped it into the php file.


The new version should be ready in a couple of days... or maybe tomorrow? i don't know yet.

WebPlanetHost.com:
Oh thankyou Daniel!!!! I love you!!!!! I have been waiting for a mod like this for ages!!! If you want a free .com, .net or .org domain please contact me on my forum www.webplanethost.com/forum [nofollow]

I am so happy now  ;D

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version