Joomla plugin and templating: how to know if you are in the frontpage

There are many situations in which a joomla developer needs to know if the code is being shown / executed in the main page. This is, the “context” in which the code is executed. For instance, if you want to use a different template for the frontpage and another for other visualizations (custom frontpage). Or if you only want a plugin to be shown if the page is not frontpage.

How is this done?

Joomla 1.0.*

<?php if($_REQUEST['option']=="com_frontpage" || !isset($_REQUEST['option'])){?>
Have the HTML code for the homepage layout
<? }
else{?>
Have HTML code for the rest of the pages
<?php } ?>

Joomla 1.5.*

<?php if($_REQUEST['view']=="frontpage") {?>
Have the HTML code for the homepage layout
<? }
else{?>
Have HTML code for the rest of the pages
<?php } ?>

Related posts:

  1. Joomla templating – know where you are (full article view or article-listing) [SOLVED]
  2. Drupal theming: know if you are in homepage [solved]
  3. AddThis plugin for joomla 1.5
  4. WordPress: where am I? is it the frontpage? [solved]
  5. Joomla: know the section of an article [SOLVED]

2 Responses to “Joomla plugin and templating: how to know if you are in the frontpage”

Leave a Reply

Paypal donate

Please help me keep this blog up by donating.

Por favor, ayúdame a continuar con el blog donando.