|
|
Admin-controlled switch for implementation in templates
Switch between parts of your template, or use it as an on/off-switch to publish/unpublish template-parts per page !
It's specific purpose is to enable you to switch parts of a template on/off per page, independently of the presence of other modules and/or other module-positions. I needed a way show up specific HTML/script-parts of my template only on 1 or 2 pages of my website. In my case an image, and a piece of CSS-script to alter the background-image only on one page. And I sure did NOT want to have to build switches based on $_GET-content that deal with article/category/section/menuitem-ids or something, leaving me finally having to hack that code directly into my template, and whenever I want to change anything, forcing me to go there again. No sir! So i wrote this tiny switch-module which allows me as well as any other admin to publish / unpublish that specific parts of my template only for selected pages and do so comfortably via Joomla!-backend. The usage is very simple:
<?php if($this->countModules('myIndependentPosition')) : ?> my very content ( HTML, PHP, JS, Meta-tag, IMG or whatsoever ) goes here ... and will later only be expressed on the page if the simpleSwitch module is 'shown' on that page
<?php endif; ?>
You use it just like any other module: You can show it only on specific pages of your website, or on all pages or on none. This can be defined the usual way in the module-manager → module "simpleSwitch" Since the switch is realized as a module, you can create an own position for the module in your template if u want, so you're free to use it wherever you want in your template, even in the header ( e.g. if you want to controll the inbind of a .css or .js -file or so ) Tip: You can clone the switch via the "copy" function in the modul-manager in case you need several switches in your template !
Enjoy :D
|
|
-
Ich habe eine Frage dazu ...
-
|
|