feel free to keep it strictly simple...
page headers

Initial situation

LEPTON inherited the register_frontend_modfiles() thingy that was introduced in Website Baker as a temporary solution, but never replaced then. Template developers had to add several calls to their templates to make sure that all required files are added 'automatically'.

Example:

   <?php
   if(function_exists('register_frontend_modfiles')) {
       register_frontend_modfiles('css');
       register_frontend_modfiles('jquery');
       register_frontend_modfiles('js');
   } 
   ?>

This would include frontend.css and frontend.js of any module used on a page (or any module of type 'snippet'), and jquery.min.js from the WB includes folder. There's no way to add any different named files, or load header files conditionally (based on PAGE_ID, for example).

The LEPTON way

There is only ONE method to be called in the <head> section of a page template:

   <?php
       get_page_headers();
   ?>

You can use this for both Frontend templates and Backend themes.

The function is downward compatible and automatically loads the following files of all modules used on a page (if exist):

  • <Module>/frontend.css (media: all)
  • <Module>/css/frontend.css (media: all)
  • <Module>/frontend_print.css (media: print)
  • <Module>/css/frontend_print.css (media: print)
  • <Template>/<PAGE_ID>.css (media: all)
  • <Template>/css/<PAGE_ID>.css (media: all)
  • <Template>/<PAGE_ID>_print.css (media: print)
  • <Template>/css/<PAGE_ID>_print.css (media: print)
  • <Module>/frontend.js
  • <Module>/js/frontend.js

Of course, there is an equivalent for register_frontend_modfiles_body(), too:

   <?php
       get_page_footers();
   ?>

Just include this call right before the closing </body> to automagically load:

  • <Module>/frontend_body.js

Modules may define additional files to be loaded automatically. A template designer don't have to know about this. Anyway, if you're interested in details, see the developer docs.

Conclusion

Just add

   <?php
       get_page_headers();
   ?>

to the <head> and

   <?php
       get_page_footers();
   ?>

right before </body> and you'll never have to think about this again!