By default, positions are declared by the templateDetails.php, then put into the correct <div> location for the web page by index.php both in the root of the Protostar template and the <divs> are styled with the template.css stylesheet in the css folder of Protostar.

Protostar for Joomla 3.2 comes with the following default position names as defined in templateDetails.xml:

banner
debug
position-0
position-1
position-2
position-3
position-4
position-5
position-6
position-7

position-8
position-9
position-10
position-11
position-12
position-13
position-14
footer

 

See the Protostar Module Positions to see the default location on the web page for these positions. A number of these positions are classified as "unused", which means that they are not being used by index.php. They can be assigned somewhere in index.php if you wish to do so, and if you wish to keep the numerical system for naming positions.

If, for some reason, you don't want to use the numerical system and would prefer to use position names that have name that signifies their location or role in the page, you can rename them.

Keep in mind that if you upgrade Joomla, the Protostar template files of index.php and templateDetails.xml will be overwritten. Always make a backup of your site before upgrading. You will need to go through the steps of copying and pasting your changes back in, repeating the whole renaming procedure or replacing the two new files with the old files. This last step is not always advisable, as newer versions of Protostar can have new code placed into the index.php file that would be crucial to the site's security or functionality.

You can also make a copy of the Protostar Template in Template Manager. See the steps for this here.

The templateDetails.xml tells Joomla that these positions exist, but index.php places those positions into the web page. Following is an example of how Protostar places position-1 into a <div class="navigation">

<?php if ($this->countModules('position-1')) : ?>
    <div class="navigation">
        <jdoc:include type="modules" name="position-1" style="none" />
    </div>
<?php endif; ?>

This is a combination of PHP and HTML. The PHP code lies within the <?php and ?>

The first line is saying if position-1 exists do the following steps until you see an endif; So, Joomla will test to see if some module has been assigned to position-1.  If that condition exists, it will create a <div class="navigation"> and place the module(s) with that position-1 into that <div>.

If you want to rename the positions for Protostar, you must do so in the templateDetails.xml AND in the index.php files located in the protostar folder in the templates folder. Make a copy of these files first and rename the copies with a logical name - such as adding the date. To edit the files you can either downlaod them to your own computer using an FTP program, then upload them to the same folder after editing, or you can edit them directly using cPanel or your hosts file manager.

Open the original templateDetails.xml file in a text editor such as Notepad++. Find the area where the <positions> are called out. Rename the positions as you wish, but make a list of what the original name was and how you renamed it. Save templatDetails.xml and upload back to the proper folder if necessary.

Open the index.php file in a text editor. Do a search for your first position by searching for the original name (most editors will use CNTL + F for searching). Some positions will only have one place they are called out, some are called out in the if statement as well.  Replace the position name within the single or double quotes with your new name.  Do this for each of your new position names.  Save index.php and upload it back to your site if necessary.

When you go to place a module in a position, your new postions should be on the pulldown list.  Keep in mind that any modules that were assinged to the original positions will have to be reassigned to the new names.

For example, if I wanted to rename postion-1 to horizontalmenu the lines would look like this in index.php.

<?php if ($this->countModules('horizontalmenu')) : ?>
    <div class="navigation">
        <jdoc:include type="modules" name="horizontalmenu" style="none" />
    </div>
<?php endif; ?>

Has BJ.Zemplate.com helped you with understanding Joomla?

If you would like to make a small contribution to help fund this resource, that would be great, but do not feel obligated in any way.

Donation Amounts


Still not finding a special topic?

Use Google's Search function below for search the content of bj.zemplate.com.