boardom Forum Index boardom
b2 message board
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Guidelines to submit hacks

 
Post new topic   Reply to topic    boardom Forum Index -> Hacks
View previous topic :: View next topic  
Author Message
michel v
Site Admin


Joined: 25 Jan 2002
Posts: 799
Location: Corsica

PostPosted: Sun Sep 15, 2002 3:07 pm    Post subject: Guidelines to submit hacks Reply with quote

1. Use external files if possible.
This means that instead of saying paste this function in b2template.functions.php, you should make an external file with that function, and say save that code as externalfile.php and paste this in b2templates.functions.php: include('b2-include/externalfile.php');.
This way, when the user upgrades to a new version of b2, all she has to do is add the include statement back in b2template.functions.php (and/or any other file where you add code, for that matter).
If you absolutely have to modify existing b2 code, be very clear about what you're modifying and where in the files.

2. Use good PHP.
That's a given. If you started PHP last week, it is better to submit a hack/feature request than try to make a hack and have people complaining that it doesn't work in all possible situations.
Try to make your code readable as much as possible. This means proper indenting and clear variable names.

3. Don't just replace existing b2 files.
For example if you're going to add something to the form in b2edit.form.php, don't submit a modified file and say 'just replace b2edit.form.php with this modified version'. This makes users confused about what's been modified and could leave them with a non-working hack should b2's code be modified to expect new things from b2edit.form.php.
Of course this goes for other files too. If you submit another version of an archives page, don't tell people to replace b2archives.php with it, give it another name.

4. Use existing b2 functions as much as possible.
For example, you don't need to make users fill in their db details in your new hack, just include b2config.php and then use the dbconnect() function to connect to the db.
Look in b2functions.php for functions that could fit your needs. Not only would it speed up your coding, but it would make smaller, more readable files.


If you want to comment on these guidelines or suggest other guidelines to follow, please reply here.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
GamerZ



Joined: 15 May 2002
Posts: 537
Location: Singapore

PostPosted: Sun Sep 15, 2002 4:18 pm    Post subject: Reply with quote

what about looking though the Hacks section to see which hack is suitable? If it is not suitable and it is a good hack ask the author to modify it?
_________________

++ GamerZ.Per.Sg - Complex Simplicity
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    boardom Forum Index -> Hacks All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB 2 © 2001, 2002 phpBB Group