0

I am developing a Joomla! 1.5 template. I have user1,user2 and user3 positions. I want to display these positions on the front page only not the internal pages. but I don't know how to implement it.

would you help me ?

hd.
  • 17,596
  • 46
  • 115
  • 165

1 Answers1

2

In top of /templates/TEMPLATENAME/index.php add these lines:

<?php $isHomePage = (JSite::getMenu()->getActive()->id == JSite::getMenu()->getDefault()->id); ?>

And then find rows, where module positions are included and modify them. From:

<jdoc:include type="modules" name="user1" />

, to:

<?php if ($isHomePage) { ?>
    <jdoc:include type="modules" name="user1" />
<?php } ?>
  • thank you,it is what I exactly want.but would you tell me more about getActive() and getDefault() more? – hd. Apr 21 '12 at 09:58
  • 1
    Sure. It's all about menu items from 'menu manager'. Method getDefault() returns menu item, that choosen as default for site (as home page). Method getActive() returns menu item, that is active on current page. Read more: [getActive()](http://api.joomla.org/1.5/Joomla-Framework/Application/JMenu.html#getActive) and [getDefault()](http://api.joomla.org/1.5/Joomla-Framework/Application/JMenu.html#getDefault) from Joomla 1.5 Api Documentation – Stanislav Gamayunov Apr 21 '12 at 10:22