Module Guidelines
vito edited this page Sep 12, 2010
·
12 revisions
- While it is not necessary, please provide as much documentation for your module as possible, in the form of NaturalDocs.
- Do not store any information in the module’s directory unless it is absolutely necessary to do so.
- Use
/includes/caches
for caches. - Use
Config::current()->uploads_path
for uploads. - Use “
Config::current()->set()
”:http://chyrp.net/docs/config-php.html#Config.set (on install) and “Config::current()->remove()
”:http://chyrp.net/docs/config-php.html#Config.remove (on uninstall) for storing configuration.
- Use
- Please try to keep the “conflicts” setting in the
info.yaml
file updated. - Whenever possible, use a
LEFT JOIN
to keep the load on the server down, especially for things that extend the Post model.
If you plan on providing a Model with your module, there are a few guidelines to follow:
- If it’s one model, name it
model.Foo.php
.- If it’s more than one, name them
/models/Foo.php
- If it’s more than one, name them
- Stick as close to the Model class as possible.
- When it makes sense, please provide appropriate has_many, belongs_to, and has_one relationships.