I've wrote a mini tut based on the gantry docs, just for give it a try
Gantry: Display HTML ( render() ) of a custom feature without a position
To display the HTML of the render() function just add the following code to your template index.php. You could even pass variables etc... to work with in your features render() function! $feature = $gantry->getFeature('myCoolFeature');
$feature->render([mixed] $var);
You could access any of the functions as described in the docs above. For example you have added an Enable switcher to template-options.xml and would like to get the state: if ( $feature->isEnabled() ) {
// ... do anything
}
You could also override the isEnabled() function with your own, if you would like to add additional conditions, like: /** features/feature.php */
function isEnabled() {
global $gantry;
if ( $this->enabled ) {
if ( $gantry->get('splitmenu-enabled') ) {
return true;
} else {
return false;
}
} else {
return false;
}
}
In your template-options.xml add something like the below code if you wish to enable or disable the feature within the template admin area <fields name="myCoolFeature" type="chain" label="MYCOOL_FEATURE_LBL" description="MYCOOL_FEATURE_DESC">
<field name="enabled" type="toggle" default="0" label="MYCOOL_FEATURE_ENABLE"/>
</fields>
So next time calling $feature->isEnabled() you'll get true if the splitmenu is enabled... (splitmenu, just as an example)
So you do not need a module position, just render the features html in render() function
and have a look into the modules.php in your gantry based template path: yourTemplate/html/modules.php
you could add your own module chromes here
Note:
- Clear the Cache
- Your customization may override during a template update! Always backup your files, and use one of the many file diff apps to reapply your customizations in the new template version.
- Please do not add module positions to the <head>
Why i am doing what i do? Sometimes it simply came over me!
Don't forget to hit the
THANKS button for those who helped you and for those who need this for their alter ego