[WIP]Starting a Mod, looking for some input of how to proceed

Started by Turkeybowl, December 12, 2009, 04:07:30 AM

Previous topic - Next topic

Turkeybowl

Greetings,

I am quite new to PHP and mySQL, but am working on improving my knowledge.  Most would say that doing is the best way to learn, so I'm diving right into it.

Forum Info:
SMF 2.0 RC 1.2
Ad Management v2.3.5
Black Rain theme which is modified slightly

I'm looking to create a mod that will do several things.  First, I'd like it to create a new tab on the menu for the members to click on and interact with the mod.  The mod itself will have two functions.  First and foremost, I want it to have a form they can fill out and submit.  Upon submission, the data entered will be parsed into appropriate fields and stored in a new table linking to their user id.  The data will also be formatted and a post will be created on one of the forums on the board.  After submission, the member will be taken to the post created on the forum.  The second part of the mod would be a means for members to pull up the information from all the forms they've submitted to look at their progress over time (likely a button that would expand under the input form with old data when clicked).

I've enough knowledge in PHP, mySQL, and HTML to get this done separately from the forums, but I'd like to incorporate it into the forums as best I can.

Quite frankly, I'm rather at a loss of where to begin.  I've done a little digging and come up with the idea of creating a new action for members to use.  Add the action to the index.php file in the root.  Create an Action.php file in the Sources folder.  Create a subs-action.php file also in the Sources folder, and lastly, create an Action.template.php in the theme folder.

What would go into each file, I'm not quite certain of.  The Action.php file would have the programming to undertake for the two main functions of the action.  Submit the form, or call up the previous data for that user and display it under the input form.  The Action.template.php file would have the html for the page, linking to the Action.php functions depending on what actions are taken on the page, and I'm not really certain what would need to go into the subs.Action.php file

Any help, comments, or direction would be greatly appreciated.

Arantor

The Action.php file contains the logic to make it work, which usually means the form itself plus the saving of said form. You'll find in SMF, that action=something displays the form, action=something2 saves its contents.

Action.template.php is concerned solely with displaying the contents of Action.php's work.

Subs-Action.php isn't required generally, unless it's something that could be called in multiple places. For example, Subs-BoardIndex.php holds the board index loader - because it's also used in MessageIndex.php.

So, first up, you'd add the two actions to the array in index.php to point to Action.php and the form-display and form-handler functions (see what post and post2 point to, for example - they refer to Post.php, post and post2 functions)

The best thing to do is to look around at existing mods and see how they work. In terms of creating a button and a simple action, my Buddy Page mod is a not so bad example of that. It's one button, one action and one template.

I'm not sure what I'd need to tell you next though - I don't know what more specifically you need in order to help you get moving on this.
Holder of controversial views, all of which my own.


Turkeybowl

Quote from: Arantor on December 12, 2009, 04:14:49 AM
The Action.php file contains the logic to make it work, which usually means the form itself plus the saving of said form. You'll find in SMF, that action=something displays the form, action=something2 saves its contents.

Action.template.php is concerned solely with displaying the contents of Action.php's work.

Subs-Action.php isn't required generally, unless it's something that could be called in multiple places. For example, Subs-BoardIndex.php holds the board index loader - because it's also used in MessageIndex.php.

So, first up, you'd add the two actions to the array in index.php to point to Action.php and the form-display and form-handler functions (see what post and post2 point to, for example - they refer to Post.php, post and post2 functions)

The best thing to do is to look around at existing mods and see how they work. In terms of creating a button and a simple action, my Buddy Page mod is a not so bad example of that. It's one button, one action and one template.

I'm not sure what I'd need to tell you next though - I don't know what more specifically you need in order to help you get moving on this.
Well, I don't know yet.  I'll look into what you've suggested, get where I can, and likely be back in a day or so with more questions.  Thanks for the help.

Advertisement: