Welcome to Geeklog, Anonymous Monday, December 23 2024 @ 06:24 pm EST
Geeklog Forums
Alternate theme based on URL redirect...
Brian
Anonymous
Is it possible to have geeklog select different themes based on which URL directed to the site?
I have a unique case in which a church has a seperate site for both their contemporary and traditional worship services. The content and events pertain to the whole church, but they want a separate layout for the two sites. I already have the themes designed, but I have no idea how to set it up for this situation.
Basically all I'm looking for is a way to generate a link to load the site with a specified theme. If anyone can help me with this I would greatly appreciate the assistance.
I have a unique case in which a church has a seperate site for both their contemporary and traditional worship services. The content and events pertain to the whole church, but they want a separate layout for the two sites. I already have the themes designed, but I have no idea how to set it up for this situation.
Basically all I'm looking for is a way to generate a link to load the site with a specified theme. If anyone can help me with this I would greatly appreciate the assistance.
9
9
Quote
Status: Banned
machinari
Forum User
Full Member
Registered: 03/22/04
Posts: 1512
i'm a bit confused...
you have two different sites, and two themes.... and you want each site to look different. Am still on the right path? why not just install a different theme per site. Or is there a 3rd site in the mix somewhere, which will be visited by users from these two?
you have two different sites, and two themes.... and you want each site to look different. Am still on the right path? why not just install a different theme per site. Or is there a 3rd site in the mix somewhere, which will be visited by users from these two?
14
9
Quote
Status: offline
knuff
Forum User
Full Member
Registered: 12/17/04
Posts: 340
Location:Sweden
Hi,
The answer is yes. Just use the same database and set the different default theme in the respective config.php.
You could even take it a step further depending on what you want to do, like same user base, plugins and static pages, but different or limited content on one or the other.
Example, I have a few different subdomain names, that only display a certain topic of the main site with a different theme.
E.g.
--------------------------------
www.mysite.com:
Topics:
Global
Topic1
Topic2
Global Theme
--------------------------------
topic1.mysite.com
Topics:
Topic1
Topic1 Theme
--------------------------------
However if like Machinari mentioned, it is really just two different themes and one GL database, with the same content the esiest is to just run two installs with the same DB.
It´s just a question of keeping them in sync.
If you want to go through the hassle of sharing the backend and having two different frontends, have a look How can I run multiple sites using one code base?
Geeklog is very powefull and a lot of people have it running in more complex configurations to share the user base over multiple sites.
Best Regards,
Boris
Vanrillaer.com - our Family Portal
The answer is yes. Just use the same database and set the different default theme in the respective config.php.
You could even take it a step further depending on what you want to do, like same user base, plugins and static pages, but different or limited content on one or the other.
Example, I have a few different subdomain names, that only display a certain topic of the main site with a different theme.
E.g.
--------------------------------
www.mysite.com:
Topics:
Global
Topic1
Topic2
Global Theme
--------------------------------
topic1.mysite.com
Topics:
Topic1
Topic1 Theme
--------------------------------
However if like Machinari mentioned, it is really just two different themes and one GL database, with the same content the esiest is to just run two installs with the same DB.
It´s just a question of keeping them in sync.
If you want to go through the hassle of sharing the backend and having two different frontends, have a look How can I run multiple sites using one code base?
Geeklog is very powefull and a lot of people have it running in more complex configurations to share the user base over multiple sites.
Best Regards,
Boris
Vanrillaer.com - our Family Portal
9
8
Quote
Brian
Anonymous
I guess I wasn't very clear in my first post... that tends to happen when I post late at night, lol.
It's just 1 site, one database, but there are two different domains redirecting to it. I want it to load a different theme based on which site redirected.
e.g.
i'm hosting the site on my personal server
site1.com will redirect and load the theme site1
site2.com will redirect and load the theme site2
It's just 1 site, one database, but there are two different domains redirecting to it. I want it to load a different theme based on which site redirected.
e.g.
i'm hosting the site on my personal server
site1.com will redirect and load the theme site1
site2.com will redirect and load the theme site2
11
16
Quote
Status: offline
Dirk
Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Quote by Brian: It's just 1 site, one database, but there are two different domains redirecting to it. I want it to load a different theme based on which site redirected.
I made a little hack like that for a client once. Seem to have lost the source code, though ...
The idea was to set the 'theme' cookie for all those that come in through the second domain.
So in domain1, you have a default theme (as usual) and users can not change the theme, even though you have two themes on the site. When someone comes in through domain2, you set their theme cookie (pretty early in lib-common.php) to the second theme.
I think back then I did that by appending a ?settheme=secondthemename to the URL when redirecting people, but you could also check the referrer.
bye, Dirk
9
14
Quote
Status: offline
trinity
Forum User
Regular Poster
Registered: 01/30/05
Posts: 80
just check the $_SERVER['HTTP_HOST'] var and see what the domain is and set theme acordingly in config.php
switch ($_SERVER['HTTP_HOST'] ) {
case 'www.foo.com';
$_CONF['theme'] = 'foo'; // foo theme
break;
case 'www.bar.com';
$_CONF['theme'] = 'bar'; // bar theme
break;
default:
$_CONF['theme'] = 'blaw'; // blaw theme
}
This should work but you might need to get the domain format just right
glFusion - Technology Fused with Style - www.gllabs.org
Text Formatted Code
switch ($_SERVER['HTTP_HOST'] ) {
case 'www.foo.com';
$_CONF['theme'] = 'foo'; // foo theme
break;
case 'www.bar.com';
$_CONF['theme'] = 'bar'; // bar theme
break;
default:
$_CONF['theme'] = 'blaw'; // blaw theme
}
This should work but you might need to get the domain format just right
glFusion - Technology Fused with Style - www.gllabs.org
8
8
Quote
Status: offline
beewee
Forum User
Full Member
Registered: 08/05/03
Posts: 969
Location:The Netherlands, where else?
There's a Chameleon hack somewhere to have a different layout for each topic.
Dutch Geeklog sites about camping/hiking:
www.kampeerzaken.nl | www.campersite.nl | www.caravans.nl | www.caravans.net
Dutch Geeklog sites about camping/hiking:
www.kampeerzaken.nl | www.campersite.nl | www.caravans.nl | www.caravans.net
8
11
Quote
Brian
Anonymous
Thanks for the help Dirk, I thought it would be just a simple little switch like that. Unfortunately, I can't seem to get the code suppliment to work.
Don't I just need to tack it on the end after index.php?
Don't I just need to tack it on the end after index.php?
8
9
Quote
Status: offline
Dirk
Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Quote by Brian: Don't I just need to tack it on the end after index.php?
For the idea I've outlined above, the code has to go into lib-common.php (as mentioned there), somewhere before the code that selects the user's theme.
bye, Dirk
9
9
Quote
Brian
Anonymous
I suppose I'm just incompetant, but I still have a bit of an issue.
I imagine the code trinity posted would work if the differen't domains listed my single server as the host, but this isn't the case. They come to my site through a simple HTML redirect and because of this it still references my domain for the theme.
Am I just going to have to set up 2 sperate sites that reference the same database but use different themes?
I imagine the code trinity posted would work if the differen't domains listed my single server as the host, but this isn't the case. They come to my site through a simple HTML redirect and because of this it still references my domain for the theme.
Am I just going to have to set up 2 sperate sites that reference the same database but use different themes?
9
12
Quote
Brian
Anonymous
Hey everyone, back again
I have finally gained access to both domains so I could point them to my webserver directly and avoid using an html redirect. However, Trinity's code still doesn't seem to work out for me. It always goes straight to the default theme, I haven't the foggiest as to why.
I just want to set it up in some way that domain1 loads theme1 and domain2 loads theme2. I suppose if I have to I'll upload 2 sets of the public_html and 2 different config.php files, but I'd like to avoid this redundancy if at all possible.
I have finally gained access to both domains so I could point them to my webserver directly and avoid using an html redirect. However, Trinity's code still doesn't seem to work out for me. It always goes straight to the default theme, I haven't the foggiest as to why.
I just want to set it up in some way that domain1 loads theme1 and domain2 loads theme2. I suppose if I have to I'll upload 2 sets of the public_html and 2 different config.php files, but I'd like to avoid this redundancy if at all possible.
9
10
Quote
Status: offline
drshakagee
Forum User
Full Member
Registered: 10/01/03
Posts: 231
Quote by Brian: Hey everyone, back again
I have finally gained access to both domains so I could point them to my webserver directly and avoid using an html redirect. However, Trinity's code still doesn't seem to work out for me. It always goes straight to the default theme, I haven't the foggiest as to why.
I just want to set it up in some way that domain1 loads theme1 and domain2 loads theme2. I suppose if I have to I'll upload 2 sets of the public_html and 2 different config.php files, but I'd like to avoid this redundancy if at all possible.
I have finally gained access to both domains so I could point them to my webserver directly and avoid using an html redirect. However, Trinity's code still doesn't seem to work out for me. It always goes straight to the default theme, I haven't the foggiest as to why.
I just want to set it up in some way that domain1 loads theme1 and domain2 loads theme2. I suppose if I have to I'll upload 2 sets of the public_html and 2 different config.php files, but I'd like to avoid this redundancy if at all possible.
I never tried her code, but if you delete your cookies from your site you might have better luck.
Yes I am mental.
14
9
Quote
All times are EST. The time is now 06:24 pm.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content