in Web Development

PyroCMS Module Development Tip: Config and Multiple Admin Files

Yesterday I was able to get some good solid development time in on a module that I’ve been hacking away on and I discovered a couple of things I think are worth pointing out to other PyroCMS developers. Both of these pertain to module development.

  • Use that config folder to create a CodeIgniter like config file.  Use this for items that you might be repeating over and over again. Pretty straight forward, but it’s not documented at this point.
  • It appears that if you are going to have more than one admin file,  you’ll have to setup some routes, which also reside in the config folder.  For instance your base admin file will be admin.php but if you need another file called admin_widgets.php you’ll have to setup a route similar to this in order for it to work (I’m unsure if there are other ways to accomplish this. I’m basing this off of what I saw in one of the other core modules).
$route['mymodule/admin/admin_widgets(/:any)?'] = 'admin_widgets.php$1';

For right now that’s all I got, but I’m sure I’ll come up with more as I get further into this module. Happy coding.

This was written when PyroCMS was on version 2.2 and was mostly CodeIgniter based.