Testing for exact URL / Home page? (SOLVED)

Discuss the development and implementation of Joomla! 1.0.x templates here.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Locked
User avatar
inspired333
Joomla! Apprentice
Joomla! Apprentice
Posts: 48
Joined: Thu Dec 22, 2005 11:06 pm
Location: New Zealand
Contact:

Testing for exact URL / Home page? (SOLVED)

Post by inspired333 » Sat May 03, 2008 2:21 pm

Hi Folks,
I have a module I only want to display if the user is looking at the home page.
Now I managed to sort of do what I want by setting the module to only load for the "mainmenu: home" location in the "Menu Item Link(s): " in the module set up.

But this does not prevent the module for loading when a 404 error is generated, and when the register and login pages are loaded. All of these seem to utilise the "homepage" so the module loads in these instances. I need it to load ONLY when on the actual homepage as if the user just came to the site or has clicked a HOMEPAGE link on the site.

Is there any way I can test for this and then use some sort of IF statement in the template to not display that POSITION I have set up specifically for this module... or even better, to just keep the position there (as I may want other things to display there at some point) but to prevent the module for loading when it's the actual homepage?

With thanks,

Jonathan
Last edited by inspired333 on Sun May 04, 2008 6:34 am, edited 1 time in total.
The next re-volution is a global one...
It's exact form I can not predict...
One thing I know for sure... it shall be... A revolution in consciousness.

User avatar
inspired333
Joomla! Apprentice
Joomla! Apprentice
Posts: 48
Joined: Thu Dec 22, 2005 11:06 pm
Location: New Zealand
Contact:

Re: Testing for exact URL / Home page?

Post by inspired333 » Sat May 03, 2008 3:01 pm

Okay... managed to figure this one out.

Achieved it by using this:

$here = $currentpage = $_SERVER['REQUEST_URI'];
//echo $here;
if ( $here == "/" or $here == "/index.php?option=com_frontpage&Itemid=1" or $here == "/index.php")
{
if (mosCountModules('boxmenu')>0) mosLoadModules('boxmenu',0);
//designate tech.php#tech02 as currentlink
}
?>

Perhaps this'll help someone else wanting to do something similar.

Regards,
Jonathan
The next re-volution is a global one...
It's exact form I can not predict...
One thing I know for sure... it shall be... A revolution in consciousness.

User avatar
ercilia
Joomla! Apprentice
Joomla! Apprentice
Posts: 33
Joined: Tue Jun 20, 2006 10:05 pm

Re: Testing for exact URL / Home page? (SOLVED)

Post by ercilia » Mon May 19, 2008 3:52 pm

I am using Joomla! 1.0.15 with rocketheme catalyst. There is a module assigned to the frontpage only( assigned mainmenu:home). But it shows up also in registration page and lost password page as well as ads from ads manager "latest ads" module.

I think this is the same issue you describe. I would like to try your fix. Which file did you add this code to?

Thank you for your help.

mhunkler
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 110
Joined: Fri Nov 14, 2008 4:58 am
Contact:

Re: Testing for exact URL / Home page? (SOLVED)

Post by mhunkler » Wed Dec 09, 2009 6:36 am

where was this code added??
iPad Case, iPad Screen Protector, and other iPad Accessories...

http://www.ipadaccessoriesinc.com

SeRiAl_H
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Fri Aug 19, 2011 4:23 am

Re: Testing for exact URL / Home page? (SOLVED)

Post by SeRiAl_H » Sun Mar 04, 2012 11:10 pm

This problem is Solved here on this page with a VERY simple solution that doesn't require hacking code or changing any core code

http://www.joomlabamboo.com/blog/tutori ... emid-issue


Locked

Return to “Templates & CSS - 1.0.x”