Topics

User Functions

Events

There are no upcoming events

What's New

Stories

No new stories

Comments last 2 weeks

No new comments

Trackbacks last 2 weeks

No new trackback comments

Links last 2 weeks

No recent new links

NEW FILES last 14 days

No new files

Welcome to Geeklog Sunday, May 19 2013 @ 10:32 PM EDT


 Forum Index > Extensions > Cool Hacks New Topic Post Reply
 multilingual featered story
   
suvi
 12/29/05 11:05AM (Read 1401 times)  
+++--
Chatty

Status: offline


Registered: 11/20/05
Posts: 44

There can be only one featured story and storys don't support php so far.
I needed to make a biligual site (english/german). So I made this ugly
hack in index.php in order to have the featured story adjusted to the
selected language:

if ( !empty ($_USER['language'])) {
$lang = $_USER['language'];
} elseif ( !empty ($_COOKIE['language'])) {
$lang = $_COOKIE['language'];
} else {
$lang = $_language_default;
}
if ( strtolower($lang) == "english_utf-8" ) {
//we don't do anthing, because the featured story is allready in english.
} else {
//now following the german context
$A['introtext']= 'Zurich Telecom blablabla...';
$A['title'] = 'Wilkommen bei Zurich Telecom!';
}

// display first article
$display .= STORY_renderArticle ($A, 'y');


The STORY_renderArticle() Function just plots out the other text.
It's ugly, it's small and it works.

This hack works on GL 1.4 beta 1 . Anyone with a nicer hack please post.

Cheers
Suvi and jump good to 2006 from switzerland.

 
Profile Email Website
 Quote
LWC
 12/29/05 12:17PM  
+++++
Full Member

Status: offline


Registered: 02/19/04
Posts: 811
Why just the featured story? I see you use - at least partially - the original multilingual hack by Euan.

Euan's code is outdated and was later fixed and improved by yours truly - especially since Euan's version stopped working once Geeklog was upgraded. My code's purpose is to achieve the same thing, but while interfering as less as possible with Geeklog's core.

If you use it, your visitors could choose a language (via a cookie) and will only see topics and stories (and in my new version, also polls) in that language.

I've kept my hack updated in the "feature request" sub-site, which is down currently.

And I don't know where else to keep this code, so I've just opened a new topic just for my own hack. I would always keep it updated there from now on.

 
Profile Email Website
 Quote
Content generated in: 0.19 seconds
New Topic Post Reply

Normal Topic Normal Topic
Sticky Topic Sticky Topic
Locked Topic Locked Topic
New Post New Post
Sticky Topic W/ New Post Sticky Topic W/ New Post
Locked Topic W/ New Post Locked Topic W/ New Post
View Anonymous Posts 
Able to post 
Filtered HTML Allowed 
Censored Content