Themes

Parent Previous Next

The extension supports ability to create themes. All themes are located in <joomla_directory>/components/com_ariquiz/themes/ folder. Each theme is stored in separate folder (root theme folder). Active theme can be set on Configuation page with help of "Default theme" parameter.


If you want to create a new theme, we recommend to use "default" theme (it is located in <joomla_directory>/components/com_ariquiz/themes/default folder). Create a new folder for new theme in <joomla_directory>/components/com_ariquiz/themes/ folder. Folder name should contain only English alphabet characters and numbers. After this copy files from <joomla_directory>/components/com_ariquiz/themes/default folder to created folder. Open loader.php file in created folder, find the next code:


class AriQuizThemeLoader_Default extends AriQuizThemeLoader


and replace Default postfix with name of new theme (this is the name of created folder with the first letter in upper case). For example if you create myFirstTheme folder, replace the code with the following one:


class AriQuizThemeLoader_MyFirstTheme extends AriQuizThemeLoader


By default styles.css CSS file is loaded from css sub-folder in root theme folder. If you want to load additiona javascript or CSS file, you can do it in load() method of created theme PHP class. For example if you want to load script.js javascript file from scripts sub-folder in root theme folder and extra_styles.css CSS file from css sub-folder in root theme folder, code in loader.php will look in the next way:


<?php

defined('ARI_FRAMEWORK_LOADED') or die;


AriKernel::import('Application.ARIQuiz.ThemeLoader');


class AriQuizThemeLoader_MyFirstTheme extends AriQuizThemeLoader

{

       function load()

       {

               $doc =& JFactory::getDocument();

               $theme = $this->getName();


               $doc->addStyleSheet(JURI::root(true) . '/components/com_ariquiz/themes/' . $theme . '/css/extra_styles.css');

               $doc->addScript(JURI::root(true) . '/components/com_ariquiz/themes/' . $theme . '/scripts/script.js');

               

               parent::load();

       }

}