Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
- Index
- » Chameleon / ChameleonLite
- » Chameleon
- » [solved] How can i redirect for "one...
[solved] How can i redirect for "one day" after cookie is detected?
[solved] How can i redirect for "one day" after cookie is detected?
Hi! My first post here, in the forum of this great component.
I have two rules:
- first: if a link contains "id_partner=100" redirect to menu voice "page100" ad write a cookie A
- second: for every link, if cookie A is detected, redirect to "page100"
i have to limit the duration of cookie because i want to have second rule valid only for 24h after the first action.
So, a user go to the site with the first special "referrer" and be redirected to a specific page. If the same user in the same day (24h) go the home page of my site it will be redirected always to the specific page.
I think i go to create many (7/8) redirects of this type, but i'm not so good in working with sessions/cookies.
How can i set the component in this way? Thanks!!!
Re: [solved] How can i redirect for "one day" after cookie is detected?
Hi,
If you need more than 4 redirects of this type, you can't use the 4 provided cookies (A-D) so it's a matter of a small snippet of PHP.
I'd set up your 1st pair of rules like this:
Rule 1: use the following PHP code in the conditions (not in the action) to detect the cookie:
if (@$_COOKIE['partnerid'] == 100) return true;
You might also wish to include a check for the "front page of the site", if you only want this redirect to take place if they go to the front page but still allow them to go to other pages.
At the very least you need to include a check for "all pages EXCEPT the one you are redirecting to" so that the redirect does not go into an endless loop. You could do this by URL (url NOT equal to X) or menu item (exclude menu item Y).
Then in the Succeed action, set up the redirect to the page you want them to be sent to.
Rule 2: detect id_partner=100 in the link. In the Succeed Action, do the redirect and also the following PHP in the Action section:
setcookie('partnerid','100',time()+24*60*60);
Repeat this pair of rules as many times as you need to, replacing the "100" with the appropriate partner id in each case.
Cheers,
Stephen
- Index
- » Chameleon / ChameleonLite
- » Chameleon
- » [solved] How can i redirect for "one...
Board Info
- Board Stats:
- Total Topics:
- 1689
- Total Polls:
- 6
- Total Posts:
- 5942
- Total Posts Today:
- 1
- User Info:
- Total Users:
- 7624
- Newest User:
- borger3298
- Members Online:
- 0
- Guests Online:
- 236
- 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