How to add a new position to a Joomla 2.5 Template

While reviewing the PHP code in the Joomla 2.5 Beez2 template, we come across the following code:

<jdoc:include type="modules" name="position-0" />

The code above defines a new position within a template, in this case position-0. If you want to add a new position to your template, you’ll need to use code similar to the above.

What we’re going to do now is add a new position to our template, and we will name it position-xyz.

Please note:
If you would like to add positions to your Joomla 2.5 template, please make sure that you already know how to view where the current modules positions are and you know how to edit your template. If you are not familiar with HTML / CSS, this may be a difficult task for you.

Adding a new position to a Joomla 2.5 template:

  1. Update your template’s index.php file

    To add our new position, position-xyz, we’ll add the following code to our template’s index.php file.

    <div style='border:1px solid #000; padding:2px;'>
            <jdoc:include type="modules" name="position-xyz" />
    </div>
  2. Update your template’s templateDetails.xml file

    Your template’s templateDetails.xml file includes a listing of all positions available within the template. After updating our index.php file, we now need to update our templateDetails.xml file. The code highlighted below shows the updates that we made:

    <positions>
        <position>debug</position>
        <position>position-0</position>
        <position>position-1</position>
        <position>position-2</position>
        <position>position-3</position>
        <position>position-4</position>
        <position>position-5</position>
        <position>position-6</position>
        <position>position-7</position>
        <position>position-8</position>
        <position>position-9</position>
        <position>position-10</position>
        <position>position-11</position>
        <position>position-12</position>
        <position>position-13</position>
        <position>position-14</position>
        <position>position-xyz</position>
    </positions>
  3. Test the changes!

    If the changes were made successfully, use the template previewer on your template. In our example, we added position-xyz at the very top of the template. You can see it was added successfully in the screenshot below:
    position-xyz

Was this article helpful? Join the conversation!