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.

 

Select modules based on Referer URL on joomla 1.7

Select modules based on Referer URL on joomla 1.7

When trying to use 'Select modules based on Referer URL' I just get Parse error: syntax error, unexpected '{' sad
Don't it work beyond 1.5?

krull
Beginner Modder
ranks
useravatar
Offline
3 Posts
Administrator has disabled public posting

Re: Select modules based on Referer URL on joomla 1.7

That simply means that you did a typo somewhere in the PHP.

Can you paste the exact code you are using in the PHP box into this forum, and I'll check it for you?

It's possible that the original code in that recipe was incorrect... will check that too. Sorry in advance if that was the case!


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
3329 Posts
User info in posts
Administrator has disabled public posting

Re: Select modules based on Referer URL on joomla 1.7

Yes, that was an error in the recipe page - sorry!

The correct recipe is this:

if (array_key_exists('DID_GOOGLE_MODULE', $_COOKIE)) return;
if ( $core_genius->check( "referer starts with http://www.google/" )) {
  /* if so, set a cookie for 10 years... */
  setcookie('DID_GOOGLE_MODULE',1,time() + 10*365*24*60*60,'/');
  /* ... and show the module */
  return XXX; /* replace XXX with module id to return */
}

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
3329 Posts
User info in posts
Administrator has disabled public posting

Re: Select modules based on Referer URL on joomla 1.7

Brilliant. Didn't spot that one. Thanks.

krull
Beginner Modder
ranks
useravatar
Offline
3 Posts
Administrator has disabled public posting

Re: Select modules based on Referer URL on joomla 1.7

I think that is the recipe i need but i don't know how can i use it. I want to hide my breadcrumbs module for the shop.product_details if user come from my own page. But if they come from google or another, will see the breadcrumb. Can you help me to do that? Thank you,

Now i have put "only" in my code for hide allways at shop.product_details:

Code:

if ($_GET['page'] != "shop.product_details") {

return 168;
}

Guest
Guest
useravatar
Offline
Administrator has disabled public posting

Re: Select modules based on Referer URL on joomla 1.7

No, I wouldn't use that. Instead, I think this will work:

$vm = JomGenius("virtuemart");
$on_detailspage = $vm->check("pagetype = shop.product_details");
$from_self = $core_genius->check("referrer startswith http://www.mysite.com/"); // CUSTOMISE SITE NAME!
if (! ($on_detailspage and $from_self)) return 168;


What this does is it gets 2 pieces of information:
1 - whether it's on the details page
2 - whether it's coming from itself (referrer is your own site)

If BOTH of those conditions are true, then it should not show the module. So we negate it (the "!"), so if either of them is not true, then the module will be shown.

Hope that helps,
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
3329 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1686
Total Polls:
6
Total Posts:
5940
Total Posts Today:
1
User Info:
 
Total Users:
5198
Newest User:
Paramountdental
Members Online:
0
Guests Online:
175

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