|
Most upcoming template developers get stuck the first time, when it comes to placing the core elements. I have compiled a list of all currently existing tags, which should make placing elements a copy & paste job.
The main content Using the following PHP command makes MOS load the main content area, where you have placed this tag. This is where all the components write their output to. To make sure, the main content area only exists one time, the "include_once" command is used. To format the output MOS gives you several CSS classes, which we will learn in another lesson. <?php include_once( "mainbody.php" ); ?> |
Multiple modules MOS comes with several module positions inlcuded. Currently we have seven positions, which are LEFT, RIGHT, TOP, BOTTOM, USER1, USER2 and INSET. Every module installed can be set to one position, where it will apear. To place the modules in your template, MOS comes with a special command called "mosLoadModules" followed by the module position. You don't have to place all 7 modules postions in your template. Just the ones, you really need. The module design is controlled by serveral CSS tags again. <?php mosLoadModules( "left" ); ?> <?php mosLoadModules( "right" ); ?> <?php mosLoadModules( "top" ); ?> <?php mosLoadModules( "bottom" ); ?> <?php mosLoadModules( "user1" ); ?> <?php mosLoadModules( "user2" ); ?> <?php mosLoadModules( "inset" ); ?> |
Hiding unneeded modules In the backend an administrator can configure, which modules should appear on certain pages. Using this tool you can even turn off complete menu positions, like the hidden right menu bar many templates have. To use this feature MOS comes with an extra command called "mosCountModules" which lets you count how many modules are active on a certain page. The following PHP command string checks, if there are more than 0 modules. Only if there are modules (counter > 0) we will display the modules. If not we won't display this complete module position at all. <?php if ( mosCountModules( "left" ) > 0 ) mosLoadModules ( "left" ); ?> |
The right pathway To show the user which elements of your website he is currently browsing, MOS comes with a very nice pathway. This element is again a PHP script, which just is included at the right place. In opposition to the main content area the pathway can be included multiple times in a template (ie. at the top and the bottom). It's design can also be controlled using CSS. But sadly not all parts of the pathway can be changed. The orange colored arrow is hardcoded and can only be changed, if you either overwrite the image file (/images/M_images/arrow.png) or change the image link in the pathway.php file in the root directory. <?php include( "pathway.php" ); ?> |
Date with admin offset Another nice feature of MOS is to display the actual date with a configured offset. This can be set in the global configuration. To display this date in your template a bigger PHP string is used. We use the strftime command to echo out a formated date and time. The actual format of the date is configured through the language file variable "_DATE_FORMAT_LC". This makes localized date strings possible. To make the offset work, we take the current time and add the MOS offset, which is called "$mosConfig_offset". As the php time() command uses seconds and the MOS offset uses hours, we must multiply the offset with 60 seconds per minute and 60 minutes per hour. <?php echo ( strftime( _DATE_FORMAT_LC, time() + ($mosConfig_offset*60*60) ) ); ?> |
Loading components - adding banners As you might know MOS has an integrated banner system component. To grab a components output MOS comes with another handy internal command called "mosLoadComponent". This functions runs through the components main frontend file and put it's output on the screen. The name of the component is specified without the "com_" prefix. This can also be used to load other components output to a certain position and you may encounter a loading of a newsflash component in older templates. But as the newsflash component was turned into a module with MOS 4.5 beta 1.0.4 this won't work anymore. <?php mosLoadComponent( "banners" ); ?> |
The website's name During the installation of MOS the admin must enter a name for his website. This name is stored in the global configuration file and can be changed through the backend. To place the website's name in your template, we just echo out the name of the corresponding variable which is "mosConfig_sitename". There are no integrated style sheets for this, so formating the string is up to you. <?php echo $mosConfig_sitename; ?> |
The unlucky footer Currently MOS has no good solution for the footer of a website. Most template designers follow the official templates here and integrate a static PHP file stored int the "includes" subdirectory. So if you want to edit the websites copyright for example, webmasters have to edit the footer file by hand and have to upload it to the server again. Although this is no lucky solution it is still recommended to use the current way of integration as the static file could be replaced by a database driven configuration file one day. <?php include_once( "includes/footer.php" ); ?> | |