Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
- Index
- » MetaMod Pro
- » MetaMod Pro General Support
- » Custom URL to display module (Landing...
Custom URL to display module (Landing Page for Ads)
Custom URL to display module (Landing Page for Ads)
Hi Stephen...
I have a site that needs to display a module (for the entire session) based on the URL the visitor enters on.
The url would be something like this: http://mysite.com/?LID=123
The part of the URL that will change will be the "123"
Then, if they only enter on http://mysite.com/ one standard module needs to be displayed.
Any help with a recipe for this?
~Matt Lipscomb
Joomla! Leadership Team | Web Developer & Designer
http://www.usafreelancers.org/
Re: Custom URL to display module (Landing Page for Ads)
Hi mlipscomb,
Try this:
$instance_name = "shown_module_1";
if ( JRequest::getInt("LID") == 123 ) $_SESSION[$instance_name] = true;
if ( @$_SESSION[$instance_name] == true) {
return XXX; // if they entered with LID=123
}
else return YYY; // if they have not entered with LID=123
Replace XXX and YYY with the appropriate module ID numbers.
Re: Custom URL to display module (Landing Page for Ads)
Close, but not exact...
Should be:
JRequest::getVar
But - otherwise - it worked like magic! :-) Thank you very much for your help.
~Matt Lipscomb
Joomla! Leadership Team | Web Developer & Designer
http://www.usafreelancers.org/
Re: Custom URL to display module (Landing Page for Ads)
Hmmm... getInt() should have worked and should be a little more secure as it forces the result to be an integer. But there's nothing very wrong with using getVar() either.
Glad it worked though!
Cheers,
Stephen
Re: Custom URL to display module (Landing Page for Ads)
Ok - I *thought* it worked.
It *does* show the correct module, but does not keep that module throughout the entire session.
Any ideas?
Would it be better to set a cookie instead of using the session?
~Matt Lipscomb
Joomla! Leadership Team | Web Developer & Designer
http://www.usafreelancers.org/
Re: Custom URL to display module (Landing Page for Ads)
hmm, we could try the official Joomla cookie mechanism first, then yes, cookies would work too.
Try this. It worked for me. If it doesn't for you, then perhaps there's something up with your Joomla installation.
$instance_name = "shown_module_1";
$session =& JFactory::getSession();
if ( JRequest::getInt("LID",0) == 123 ) $session->set( "seen", true, $instance_name);
if ( $session->get( "seen", null, $instance_name ) == true) {
return XXX; // if they entered with LID=123
}
else return YYY; // if they have not entered with LID=123
- Index
- » MetaMod Pro
- » MetaMod Pro General Support
- » Custom URL to display module (Landing...
Board Info
- Board Stats:
- Total Topics:
- 1689
- Total Polls:
- 6
- Total Posts:
- 5943
- Total Posts Today:
- 1
- User Info:
- Total Users:
- 7638
- Newest User:
- moner86658
- Members Online:
- 0
- Guests Online:
- 119
- Online:
- There are no members online
Forum Legend:
Topic
New
Locked
Sticky
Active
New/Active
New/Locked
New Sticky
Locked/Active
Active/Sticky
Sticky/Locked
Sticky/Active/Locked