Tel: 0151 223 0001

We believe in three things: users, users, users.

Determine if user is viewing the frontpage in Joomla

Determine if user is viewing the frontpage in Joomla - brought to you by sdesign1 - Joomla specialists

If you want to display something specific on the homepage of your Joomla website, then you can use a snippet of PHP code which goes directly into your index.php file that sits in your theme folder. If you are using the Beez theme, then your index.php file is located in /templates/beez/index.php.

There are many reasons you may want to use a snippet of code to display something on your homepage/frontpage. You may want to put some specific content underneath your main content - for the frontpage only. You may want to edit a specific section of your tempalte, for the front page only. To do this, open your index.php file and enter:

<?php if(JRequest::getVar('view') == "frontpage" ) { ?>
After this initial bracket you will want to enter the content you wish to add. And then finish it off with a closing bracket. For example.

<p>This is my homepage</p>

<?php } ?>

Save the file, and upload it back to your webserver. The text "This is my homepage" will now appear on your homepage (the position of the text will depend on where you placed the snippet in your index.php file).

Post new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Fill in the blank