Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

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/

mlipscomb
Web Developer
Beginner Modder
ranks
useravatar
Offline
14 Posts
User info in posts
Administrator has disabled public posting

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.

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3319 Posts
User info in posts
Administrator has disabled public posting

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/

mlipscomb
Web Developer
Beginner Modder
ranks
useravatar
Offline
14 Posts
User info in posts
Administrator has disabled public posting

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

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3319 Posts
User info in posts
Administrator has disabled public posting

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/

mlipscomb
Web Developer
Beginner Modder
ranks
useravatar
Offline
14 Posts
User info in posts
Administrator has disabled public posting

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

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3319 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1674
Total Polls:
6
Total Posts:
5917
Total Posts Today:
5
User Info:
 
Total Users:
11536
Newest User:
lucero1247
Members Online:
4
Guests Online:
140


Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked