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 :: Unread Messages :: Polls :: Message Navigator
| Subscribe to topic | Bookmark topic 
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 14:29 Go to next message
gniw is currently offline  gniw   Canada
Messages: 2
Registered: November 2007
Location: Toronto
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
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] Tue, 06 November 2007 20: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
remove from buddy list
ignore all messages by this user
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 12:02 Go to previous messageGo to next message
danliker is currently offline  danliker   Switzerland
Messages: 57
Registered: January 2004
Location: Schweiz
Karma: 0
Member
add to buddy list
ignore all messages by this user
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 13: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
remove from buddy list
ignore all messages by this user
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 14: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
add to buddy list
ignore all messages by this user
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 15: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
remove from buddy list
ignore all messages by this user
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 13:50 Go to previous messageGo to next message
danliker is currently offline  danliker   Switzerland
Messages: 57
Registered: January 2004
Location: Schweiz
Karma: 0
Member
add to buddy list
ignore all messages by this user
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] Thu, 29 November 2007 19: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
remove from buddy list
ignore all messages by this user
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 08:03 Go to previous message
danliker is currently offline  danliker   Switzerland
Messages: 57
Registered: January 2004
Location: Schweiz
Karma: 0
Member
add to buddy list
ignore all messages by this user
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 08:07]

Report message to a moderator

Quick Reply
Formatting Tools:   
  Switch to threaded view of this topic Create a new topic
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: Wed Jan 19 05:23:23 EST 2022

Total time taken to generate the page: 0.00913 seconds