How to Detect that you are on Joomla Home Page

If you are a new bee to Joomla CMS and want to execute a script when the user is on the home page or want you are doing template integration in Joomla and want to use only one single template i.e. “index.php” then you must be wondering that how can I detect that the user is on the home page, accordingly change some modules or display.

Its very simple Joomla provides global variables available in your template-

<?php

if (JRequest::getVar('view') == 'frontpage')

{

echo 'this is front page';

}

?>

Simple just use if {} else {} condition as in the above code directly in your template.

Bookmark and Share
Both comments and pings are currently closed.

One Response to “How to Detect that you are on Joomla Home Page”

  1. Every time I visit this site there’s something new and improved to learn from. haha I’ve been in your source code multiple times to learn how you’re doing some things so I can put them on my site. Thanks! I can teach you about making money online. Just subscribe to my RSS Feed and follow my blog!

n