News:

Join the Facebook Fan Page.

Main Menu

Mod Tutorial?

Started by ptmuldoon, March 11, 2010, 11:12:08 AM

Previous topic - Next topic

ptmuldoon

Is there any type of basic tutorial or a 'starters kit' of mod to learn from?  Perhaps something like the infamous 'hello' sample all coders are familiar with?

Arantor

Not really because most mods require you learning PHP anyway.
Holder of controversial views, all of which my own.


ptmuldoon

Right, but...

Is there anything that tells you what you need?  an install.xml file?, specific file name.. ie, an index file? folder structure?, things like that?  I have a decent, newbie understanding of php.  But if you want to create a mod that has multiple "pages", etc.  Is there a special way to do that, where does the code get placed in SMF, etc?

Arantor

The "Important Customization Information" sticky in this board might be of use...

The only actually required file is package-info.xml, which tells the package manager where to go. Everything else is variable - there's no requirement to call the modifications install.xml, some mods have multiple, some mods don't have any of that.

Code gets placed in SMF wherever you tell it to add it...

That's why there's no tutorial for it, because really each mod will be specific and unique - best thing I can suggest is looking over other mods to see how they're done.
Holder of controversial views, all of which my own.


ptmuldoon

I'm making some very basic process, mainly working with plain html at the moment in a module for now.  But can someone tell me where/how you include a css file with your module?  I see they get placed in the themes/xxx/css folder.  But how are the css files being included?

Arantor

Use the <require-file> directive to install and <remove-file> to uninstall. See 'Tidy Child Boards' mod, covers how this can be done.
Holder of controversial views, all of which my own.


ptmuldoon

I understand the <require-file> and <remove-file>.  But I'm not sure yet how you get the css info to work in your module and template.  Where in SMF is the css info being called/included for use in your templates?

Arantor

In that case you do as I do in that mod, you add a <link> declaration to $context['html_headers'] so it can be added to the <head> in the template.
Holder of controversial views, all of which my own.


Advertisement: