0

There are times when the default layout of a Joomla! module does not fit in a specific module position the way you want. To get around this, you can create an Alternative Layout for the module if it utilizes the MVC structure and has an Alternative Layout option in the Module Manager. Typically you will find this option under Advanced Options. The MVC structure allows the web designer to override or create an alternative layout of a module from the template without hacking the core files. Adding the new layout to the template rather than the module will ensure the new layout does not get overwritten during a module or Joomla! update.

The Joomla! default login module is a good example for this tutorial because it is a vertical module that takes up quite a bit of space on the webpage. There are many module positions in a Joomla template where this would not be ideal. For example you might want a login module in the header of your page on one line.

For this tutorial we will show you how to setup an Alternative Layout for the Joomla default login module. We will not get into the details of editing the specific file. This will be covered in a future tutorial.


  1. Open the active template folder: templates/your_template/html.

  2. Create the html folder if one does not exist.

  3. Create a new folder here: templates/your_template/html/mod_login.

  4. For added security, add an empty index.html file to each folder that is created in order to prevent unauthorized browsing of this folder (Redommended).

  5. Next open the folder: modules/mod_login/tmpl.

  6. Copy the file: default.php.

  7. Paste the file into the folder we created in the template:templates/your_template/html/mod_login.

  8. Rename the file to whatever you want but make it descriptive so you know the purpose of the new layout. I will rename this file to horizontal.php because we need a horizontal layout rather than the vertical layout used in default.php.

  9. Open horizontal.php and edit accordingly.

  10. Upload horizontal.php to templates/your_template/html/mod_login

  11. Go to your Joomla Administrator and open the Module Manager.

  12. Create a new login module.

  13. Open the Advanced Options Slider Tab.

  14. Change the value for Alternative Layout from Default to horizontal.

That's it! You just created an Alternative Layout for the Login Module. You can repeat this process for multiple layouts.

Post a Comment

Emoticon
:) :)) ;(( :-) =)) ;( ;-( :d :-d @-) :p :o :>) (o) [-( :-? (p) :-s (m) 8-) :-t :-b b-( :-# =p~ $-) (b) (f) x-) (k) (h) (c) cheer
Click to see the code!
To insert emoticon you must added at least one space before the code.

 
Top