Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
- Index
- » MetaMod
- » MetaMod General Support
- » Show a module after a number of clicks?
Show a module after a number of clicks?
Show a module after a number of clicks?
Hello everyone
I use metamod for years and i am very pleased with it.
Now after all theese years i need to know if something is possible.
Here is the situation...
Visitor enters the site and a cookie is created that counts clicks till it reaches the amount of clicks we have set in the cookie. Then if the number of click is reached, then another cookie is created that lasts for 24 hours (if this cookie exists he gets the same module when he visits site for the next 24 hours), he sees a module that prompts the user to login.
Joomla! 1.5.25
Community builder
mod_metamod 2.1
Thanks in advance
Re: Show a module after a number of clicks?
Ok, that shouldn't be too hard.
$maxclicks = 20; // adjust here as required
$show = isset($_COOKIE['showmodule']);
if ($show) {
return XXX; // replace XXX with module id of module to show
}
$clickcounter = @$_COOKIE['clickcounter'];
if ($clickcounter < $maxclicks) {
setcookie("clickcounter", $clickcounter + 1, time()+60*60*24*30); // 30 days expiry
} else {
setcookie("clickcounter", 0, time()-100000); // expire the counter cookie
setcookie("showmodule", 1, time()+60*60*24); // show the module for 1 day
}
Hope that helps,
Stephen
- Index
- » MetaMod
- » MetaMod General Support
- » Show a module after a number of clicks?
Board Info
- Board Stats:
- Total Topics:
- 1689
- Total Polls:
- 6
- Total Posts:
- 5944
- Posts this week:
- 2
- User Info:
- Total Users:
- 7658
- Newest User:
- carre82601
- Members Online:
- 0
- Guests Online:
- 153
- 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