FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum » How To » How to specify a theme (language) in the URL?
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
How to specify a theme (language) in the URL? [message #39561] Tue, 06 November 2007 19:29 Go to next message
gniw is currently offline  gniw   Canada
Messages: 2
Registered: November 2007
Location: Toronto
Karma: 0
Junior Member
I am testing FUDForums for a multi-lingual (Chinese & English) web site, and I'd like the visitor to see FUDForums in Chinese if they clicked a link from the Chinese site and see FUDForums in English if they clicked a link from the English site. Is this possible and how do I do it? Thanks a lot!
Re: How to specify a theme (language) in the URL? [message #39564 is a reply to message #39561] Wed, 07 November 2007 01:32 Go to previous messageGo to next message
Ilia is currently offline  Ilia   
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
You can do that but you need to a bit of code that would change the user's theme to the one utilizing the desired language of choice.

FUDforum Core Developer
Re: How to specify a theme (language) in the URL? [message #39691 is a reply to message #39564] Tue, 20 November 2007 17:02 Go to previous messageGo to next message
danliker is currently offline  danliker   Switzerland
Messages: 57
Registered: January 2004
Location: Schweiz
Karma: 0
Member
can you give some hints, how to do this ?

like to do the same ...
Re: How to specify a theme (language) in the URL? [message #39693 is a reply to message #39691] Tue, 20 November 2007 18:07 Go to previous messageGo to next message
Ilia is currently offline  Ilia   United States
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
First of all create 2 themes, call them "english" and "chinese".

Then open users.inc.t and look for the line which says:
define('fud_theme', 'theme/' . ($u->theme_name ? $u->theme_name : 'default') . '/');


Above this line you can do

if (!empty($_GET['theme'])) {
$u->theme_name = $_GET['theme'];
}


FUDforum Core Developer
Re: How to specify a theme (language) in the URL? [message #39694 is a reply to message #39561] Tue, 20 November 2007 19:31 Go to previous messageGo to next message
gniw is currently offline  gniw   Canada
Messages: 2
Registered: November 2007
Location: Toronto
Karma: 0
Junior Member
Would this change need to be replicated elsewhere? I made the change and tried adding ?theme=Chinese_traditional to the URL but this does not seem to have any effect. Or maybe I am not changing the URL correctly?
Re: How to specify a theme (language) in the URL? [message #39706 is a reply to message #39694] Wed, 21 November 2007 20:13 Go to previous messageGo to next message
Ilia is currently offline  Ilia   United States
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
You need to rebuild the theme after making the change.

FUDforum Core Developer
Re: How to specify a theme (language) in the URL? [message #39761 is a reply to message #39561] Wed, 28 November 2007 18:50 Go to previous messageGo to next message
danliker is currently offline  danliker   Switzerland
Messages: 57
Registered: January 2004
Location: Schweiz
Karma: 0
Member
ok, it works but only until to the next click, then it goes back to the default theme !?
Re: How to specify a theme (language) in the URL? [message #39783 is a reply to message #39761] Fri, 30 November 2007 00:14 Go to previous messageGo to next message
Ilia is currently offline  Ilia   
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Well, you may want to store the value inside the cookie and fetch it from there.

FUDforum Core Developer
Re: How to specify a theme (language) in the URL? [message #39795 is a reply to message #39561] Tue, 04 December 2007 13:03 Go to previous message
danliker is currently offline  danliker   Switzerland
Messages: 57
Registered: January 2004
Location: Schweiz
Karma: 0
Member
on my site this works now with:

if (!empty($_COOKIE["sprache"])){
$u->theme_name = $_COOKIE["sprache"];
}

if (!empty($_GET['theme'])) {
$u->theme_name = $_GET['theme'];
setcookie("sprache", $_GET['theme'], time()+36000);
}

[Updated on: Tue, 04 December 2007 13:07]

Report message to a moderator

  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: How can mods temp. ban someone.
Next Topic: Mark a Thread as Read
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 09 12:14:50 GMT 2024

Total time taken to generate the page: 0.02570 seconds