-
-
Save brentini/3029961 to your computer and use it in GitHub Desktop.
Blank Template Snippets for Joomla! 2.5 - http://blank.vc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# all php files :: disallow direct access of file | |
# between <?php and ?> | |
defined('_JEXEC') or die; | |
# index.php :: define variable with application | |
# between <?php and ?> | |
$app = JFactory::getApplication(); | |
# index.php :: define variable with document | |
# between <?php and ?> | |
$doc = JFactory::getDocument(); | |
# index.php :: define variable with template path | |
# between <?php and ?> | |
$tpath = $this->baseurl.'/templates/'.$this->template; | |
# index.php :: load cascading style sheet throught API | |
# between <?php and ?> | |
# note: If you change the version number, the browser think it is a new file | |
$doc->addStyleSheet($tpath.'/css/template.css.php?v=1.0.0'); | |
# index.php :: unset css file from head | |
# between <?php and ?> | |
unset($doc->_styleSheets[$this->baseurl.'/media/zoo/assets/css/reset.css']); | |
# index.php :: add custom css | |
# between <?php and ?> | |
$doc->addStyleDeclaration('body{background-color:red;}'); | |
# index.php :: load javascript file | |
# between <?php and ?> | |
$doc->addScript($tpath.'/js/modernizr.js'); | |
# index.php :: unset javascript file from head | |
# between <?php and ?> | |
unset($doc->_scripts[$this->baseurl.'/media/system/js/mootools-core.js']); | |
# index.php :: add custom javascript | |
# between <?php and ?> | |
$doc->addScriptDeclaration('alert(\'Hello Joomla!\')'); | |
# index.php :: add custom tag | |
# between <?php and ?> | |
$doc->addCustomTag('<!-- What a beautiful comment! -->'); | |
# index.php :: load the global joomla header | |
# between <head> and </head> | |
<jdoc:include type="head" /> | |
# index.php :: system messages output incl. prevention message box (div tag) | |
# needs variable $app | |
# between <body> and </body> | |
<?php if (!empty($app->getMessageQueue)) : ?> | |
<jdoc:include type="message" /> | |
<?php endif ?> | |
# index.php :: article and component output | |
# between <body> and </body> | |
<jdoc:include type="component" /> | |
# index.php :: module output of "menu", which have to be mentioned in templateDetails.xml | |
# between <body> and </body> | |
<jdoc:include type="modules" name="menu" style="xhtml" /> | |
# templateDetails.xml :: creation of a new module position called "menu"; | |
# between <positions> and </positions> | |
<position>menu</position> | |
# index.php :: insert debug module; important for developers | |
# before </body> | |
<jdoc:include type="modules" name="debug" /> | |
# index.php :: output of the base url | |
# between <?php and ?> | |
echo $this->baseurl; | |
# index.php :: load application (line 1) and output of sitename (line 2) | |
# between <?php and ?> | |
$app = JFactory::getApplication(); | |
echo $app->getCfg('sitename'); | |
# index.php :: if construct; true, if module is published on position menu | |
# between <?php and ?> | |
if ($this->countModules('menu')) : | |
# index.php :: if construct; true, if http user agent is mobile device | |
# between <?php and ?> | |
if(preg_match('/iphone|ipod|opera mini|blackberry|android|iemobile/i', $_SERVER['HTTP_USER_AGENT'])) : | |
# index.php :: extend the if statement from above to execute another statement | |
# between <?php and ?> | |
else : | |
# index.php :: closing the if statement | |
# between <?php and ?> | |
endif; | |
# index.php :: short write if, then, else for echo a class | |
# between <?php and ?> | |
echo ($this->countModules('menu')) ? ('menu-class') : ('no-menu-class'); | |
# index.php :: disappear the generator tag | |
# between <?php and ?> | |
$this->setGenerator(null); | |
# index.php :: load the application (line 1), get the params (line 2) | |
# and get the page class from the current menu entry (line 3) | |
# between <?php and ?> | |
$app = JFactory::getApplication(); | |
$params = $app->getParams(); | |
$pageclass = $params->get('pageclass_sfx'); | |
# index.php :: load the modal behavior | |
# between <?php and ?> | |
JHTML::_('behavior.modal'); | |
# index.php :: output source in modal window | |
# between <html> and </html> or in articles and modules | |
<a class="modal"></a> | |
# index.php :: insert translatable text | |
# between <?php and ?> | |
echo JText::_('EXAMPLE_TEXT'); | |
# index.php :: display short system language tag; e.g. en-gb | |
# between <?php and ?> | |
echo $this->language; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment