In this exercise we will use the Protostar template, which is native to Joomla, and the Content Component (com_content), but you can use other templates in a similar fashion.

Let's start by creating an override.

  1. Create a module override in the administrator.
    1. Go to Extensions> Templates > Templates
    2. Click on Protostar Details and Files
    3. Click on the Create Overrides tab.
    4. In the Modules column, click mod_login
    5. At this point you will be taken back to Editor tab
  2. A new html folder has been created. Inside it, there is a copy of the mod_login files that can be edited.

Changes made to files inside the html folder will affect the entire site. The original module files in Joomla will be overriden. When a Joomla update is released,  changes made to these files will not be lost.

Creating an Alternative Layout

A module Alternative Layout allows users to have more control on creating changes to the layout and where these changes will be applied.

  1. Copy the default.php file and rename it to newlayout.php. The filename can not contain spaces, underscores (_), or hyphen (-).
  2. Open newlayout.php in the code editor
    1. Go to the last line of this file where there is a </form> tag.
    2. Create a new line before this tag and paste the following HTML: <p>This is an alternative layout.</p>
    3. Click Save & Close.

Enabling the Alternative Layout

Now it is time to put the module aternative layout we created in action.

  1. Go to Extensions> Modules
  2. Create an instance of the Login module.
    1. On the Advanced tab, in the Layout field, the name of the new alternative layout is displayed.
    2. Select it.
    3. On the Menu Assignment tab, select On all pages.
    4. Save and close.
  3. Create a second instance of the Login module.
    1. On the Menu Assignment tab, select On all pages except those selected
    2. Check the Home Page box
    3. Save and close.
  4. Go to your website and test the module.

If all is OK, you will see the text This is an alternative layout at the bottom of the module on the home page only.

If you have any questions or suggestions, please write in the comments below.

Pin It

Comments powered by CComment