Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: Leipe Po on May 18, 2006, 05:02:30 AM

Title: problem with creating a mod....
Post by: Leipe Po on May 18, 2006, 05:02:30 AM
hey everyone... me again  :D

i am creating a mod, but ther is some minor problem,
one of the first i'm thinking of is te following:

When somebody is gonna install the mod, it addes something to the following code:

(code snippet from index.template)

if (in_array($context['current_action'], array('search', 'admin', 'calendar', 'profile', 'mlist', 'register', 'login', 'help', 'pm')))
$current_action = $context['current_action'];



now, when making the package, would i just FIND the code and REPLACE it with the new code(then if  any other mod's modefied that code thay are broken), or should i FIND that code and use ADD BEFORE or a ADD AFTER 'search',
statement.

the rest will be taken care of later, this is the one that most puzzeled me...

if anyone would be able to help, i would apreciate it!!!  :)

cheers



Title: Re: problem with creating a mod....
Post by: Dannii on May 18, 2006, 05:12:06 AM
Well what changes to do you want to make?
Title: Re: problem with creating a mod....
Post by: Leipe Po on May 18, 2006, 05:26:19 AM
well its for the bookmark mod i'm creating for smf,

i want to add 'bookmarks' to that array, now if i replace that whole code, it can messup other mods installed that use that code... but i dont know i i can use add after, or add bofore instead of replace...
Title: Re: problem with creating a mod....
Post by: Dannii on May 18, 2006, 06:19:14 AM
Well you could do add after if you were careful with your linebreaks, but it's probably easiest to use replace.
Title: Re: problem with creating a mod....
Post by: Leipe Po on May 18, 2006, 06:26:50 AM
ok thanks for your advice, ill will first to to use add after before using replace, dont want my mod disableing other mods
Title: Re: problem with creating a mod....
Post by: Dannii on May 18, 2006, 07:16:45 AM
It won't make a difference to other mods which you use.