Developing mods

Started by Doug Heffernan, February 22, 2018, 01:22:31 PM

Previous topic - Next topic

Doug Heffernan

Hello,

I have some php/mysql knowledge and I am looking to develop mods. I had a look around at the topics mentioned in the sticky topic of this board, such as Package SDK, anyone? etc, but I still did not understand the process of developing mods. Do I need to install that and develop it from the admin panel, or do I have to copy the xml files and enter there the code? Can someone dumb it down for me please?

Suki

Almost all modders I know started out by looking at other people's mods. So best place to start is actually "borrow" someone elses mod and study it to see what does what.

Very broadly, Package SDK is just a set of definitions your xml can have, thats pretty much it, it tells you what you can do and how you can use it.

To start developing mod you don't need to install anything other than perhaps a local copy of SMF where your changes are going to be applied, once you have those changes you can put them into your .xml as instructions replace with/ add after/ add before. etc.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Doug Heffernan

Yes, I did that. I downloaded a couple of mods and looked inside them. But I did not know if I had to install the package sdk and enter the code from my admin panel and then the system was going to write it automatically to the xml file. Anyways, many thanks again for your help.

Suki

No, you have to manually fill up your xml file with whatever instructions your mod does.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Doug Heffernan

Quote from: Suki on February 22, 2018, 01:53:56 PM
No, you have to manually fill up your xml file with whatever instructions your mod does.

From what I can gather till now, the modification package should contain 2 files, one is the info file and the other the file that contains the actual code. That is for simple mods that do not manipulate the database by adding custom stuff such as tables or columns. Am I right in my assumption?

Suki

Yes, thats correct, package.info.xml contains, well, info about your mod such as your mod's version, author, SMF version compatible with, un/install instructions, etc.

A second xml file (or as many as you need) is used to "store" your code changes and how those changes are going to be applied.

Bigger mods usually need to alter the DB, in this cases, a database.php file is usually used, it contains PHP code for directly intereact with the DB, create/alter tables, inserts, deletes, etc.

Theres also the whole concept of "hooks" which can help you to reduce code edits but it might be better for you to get used to how code edits works and then move on to using hooks.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Doug Heffernan

Quote from: Suki on February 22, 2018, 02:04:47 PM
Yes, thats correct, package.info.xml contains, well, info about your mod such as your mod's version, author, SMF version compatible with, un/install instructions, etc.

A second xml file (or as many as you need) is used to "store" your code changes and how those changes are going to be applied.

Bigger mods usually need to alter the DB, in this cases, a database.php file is usually used, it contains PHP code for directly intereact with the DB, create/alter tables, inserts, deletes, etc.

Theres also the whole concept of "hooks" which can help you to reduce code edits but it might be better for you to get used to how code edits works and then move on to using hooks.

The more I am looking around, the more it is starting to make sense. The sdk package files are well doccumented with comments, and looking the at the code of other mods the pieces are starting to fall into place.

What are these hooks that you speak of btw? Can you please post a link to it?



Doug Heffernan

I just submited my first mod. I am so exited. I am surprised as to how easy and smooth it went. Smf simply rocks :)

Advertisement: