Topics

Hard Coding Modules

To give your theme a unique appearance and still take advantage of the dynamic nature of pages within Exponent, you may 'hard-code' a module into a theme.  Some examples typically used might be the menu, a search form, a site log in or a footer with information about the copyright.  Most had-coded modules MUST have a 'source' to reference the stored data, however some modules do not require a source such as login and navigation.

For 2.0 modules (controllers)

All of the 2.0 modules can be hard-coded into a theme via:

expTheme::module(array(
    'controller'=>'example',
    'action'=>'showall_examples',
    'view'=>'custom_view',
    'source"=>"@leftcol', // the source
    'title'=>'My Module Title',
    'chrome'=>true, /* chrome is false by default */
    'scope'=>'sectional' /* global(default), sectional, top-sectional */
));

For old school modules

// hard coding an old school module
expTheme::module(array(
   "module"=>"container", // name of old school module without “module” tacked on
   "view"=>"Default",  // the view to display
   "source"=>"@leftcol", // the source
   "scope"=>"top-sectional",  // display this container’s content on every top-level page link
   "chrome"=>false // don’t show this modules chrome
));

Module Scopes

There are three scopes for placing hard code modules into a theme.

  • global (which is the default), 'global' will show the same content on all pages.
  • sectional, 'sectional' will show unique content for each page, so modules/content must be added to each page individually. 
  • top-sectional, 'top-sectional' will show the same content for a page and its sub-pages, but unique to that top level page and its sub-pages.
Loading Help