kireol
kireol

Reputation: 723

How to load a different front page in drupal if a cookie is set?

I'm trying to figure out how i'd write a module or something so that drupal will show the user 1 front page. If a cookie is set, they see a different one.

So basically, I can't find the following even after googling.

where would I do this? A module? edit the theme file?

How do I show 1 page or another?

I'm using drupal 6 on a linux/apache.

Upvotes: 0

Views: 480

Answers (2)

kireol
kireol

Reputation: 723

I ended up just using PHP in the page_tpl.php

check if cookie is set if not, load page 2 and set cookie otherwise show page 1

Upvotes: 0

Piyuesh Kumar
Piyuesh Kumar

Reputation: 436

Its unclear if you want to show a different styling or completely a different set of data on the front page in case the cookie is set.

If you want to show a different styling, Create two different template files. You can use theme_preprocess_page function where you can check for the cookie ans set the appropriate template file.

Use api.drupal.org to get the structure of the function. Also use krumo to check in which index of the array(var that goes as an arguement in page_preprocess function) is the template file is being loaded.

Hope this helps!!

Upvotes: 1

Related Questions