1

i m using yootheme joomla template in joomla 1.5.x, my problem is that i want to

  • display modules (if enabled ) on front page, no joomla content ( i.e. localhost/project or localhost/project/index.php)

and

  • display contents & modules ( if enabled ) both on inner pages

my problem is that on front page (template/yoo_symphony/index.php) if i write

<jdoc:include type="component" />

then front page display only contents , no modules :(

and if i write as suggested on here and here

$pageview = JRequest::getVar('option','','GET');
if(!empty($pageview) ) : ?>
  <jdoc:include type="component" />
<?php endif; ?>  

then front page display all modules but inner pages not display any contents

i have read many articles regarding this, but no hope...:(

please provide me a perfect solution so that i can display modules on front page as well as content on inner pages


NOTE: if i write print_r($_GET) on http://localhost/project or http://localhost/project/index.php then it results

Array
(
    [option] => com_content
    [view] => article
    [id] => 44
    [Itemid] => 53
)

means there is url rewriting on front page, my main problem is that how to distiniguish front page from other pages??

ANSWER:

I got answer from my senior, Need to do below steps

1> go to joomla administrator side
2> then navigate to menu-->main menu [ Menu Item Manager :[mainmenu] ]
3> click to Home ( i.e. your default menu item )[ Menu Item: [ Edit ] ]
4> now click on change type [ Change Menu Item ]
5> select Internel link-->Articles -->Front Page -->Front Page Blog Layout
6> Apply & save
7> now go to index.php and replace <jdoc:include type="component" /> with

<?php  if($_GET['view'] !== 'frontpage' ) :?>
     <jdoc:include type="component" />
<?php endif;?>

NOTE : if i write print_r($_GET) on http://localhost/project or http://localhost/project/index.php then it returns

Array
(
    [option] => com_content
    [view] => frontpage  // see now 
    [id] => 44
    [Itemid] => 53
)
JustLearn
  • 3,645
  • 10
  • 29
  • 30
  • so on the front page there will be only Modules? or somekind of component (localhost/project)? – Alex Sep 10 '10 at 13:37
  • there is only modules on frontpage – JustLearn Sep 10 '10 at 13:46
  • There is a problem with the solution you posted in your question. It is dependent on the default menu item being a Joomla Frontpage menu item. Your test would break if you change the default page or use the wrong menu item type. If you test for the default menu item, then it will always work since a default menu item is required. – Brent Friar Sep 28 '10 at 21:15
  • @Brent I Know that, check the answer provide by Brent, that is absolutely perfect for any type – JustLearn Sep 29 '10 at 04:51
  • Oops, I am a retard. I though the edit was after the answer! Apparently I can't read dates and times! – Brent Friar Sep 30 '10 at 03:29

1 Answers1

8

I do this on several sites when I really don't need anything but modules on the home page. This works perfectly everywhere I have ever used it. Just add this in your template.

<?php
$menu = &JSite::getMenu();
if ($menu->getActive() != $menu->getDefault()) {
?>
    <jdoc:include type="component" />
<?php } ?>

One more thing to mention, In this way you will not get the Search results, as they are displayed on default page. - If you create a search page menu item, which you should if you want to control the modules on that page, then this will not affect the search page at all.

Brent Friar
  • 10,588
  • 2
  • 20
  • 31
  • I forgot to mention, this solution does not rely on you selecting the Joomla Frontpage menu type as the default home page. It also does not depend on a particular itemid. You can freely change around the home page menu item without breaking the code. – Brent Friar Sep 11 '10 at 18:05
  • Thanks this is superb , we need not to care waht we have selected for homw page – JustLearn Sep 13 '10 at 05:59