How to make 'Home' link point to original language frontpage
| Project: | Front Page |
| Version: | 6.x-1.2 |
| Component: | Code |
| Category: | support request |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
My site's default language is set to Hungarian. I'll only need 3 or 4 nodes and some default pages in English such as user registration form, login page and Forums with English interface. English user registration form is done: I've turned on English under Languages, installed i18n, activated the Profile translation module and translated the profile fields. After all, I ran into a minor problem: when the site's language is set to English the Home link leads to a Drupal post install English welcome page. (Welcome to your new Drupal website! Please follow these steps to set up and start using your website: 1.Configure your website...etc.)
So I'm just trying to fix this error with Front Page module.
1. 'Redirect your site HOME links' function doesn't work: I redirected it to http://mysite.net/hu and it but it ended up at http://mysite.net/en/hu (page not found)
2. I just tried a snippet and got stuck at this point, I need a little help with php.
<?php
$langref = parse_url($homeref, PHP_URL_PATH);
if ($langref = 'en') {
print print node_page_default(); // not sure about this one, having a hunch something's missing
}
?>Of course it didn't work, it brings in the http://mysite.net/en link with the aforementioned post install English welcome page.
3. I also have a http://mysite.net/chat URL alias set for all languages which doesn't work (Page not found) when the site is set to English: it only contains a short php code that embeds the chat client, no text to be translated. When I turn off Clean URLs it works perfectly though. (If it take off the URL alias it doesnt load either as node/1, in the English version.)
4. Is there any other simpler way to fix these? Inasmuch as I learned in forums common.inc might be the one to be modified somehow.

#1
I keep working on it:
I tried this code as snippet, although I found the sample in Drupal 5 post, pasted it in front_page module
<?phpswitch($language) {
case 'en':
$homePath = $base_path . '?q=hu';
break;
case 'hu':
$homePath = $base_path . '?q=hu';
break;
default:
$homePath = $base_path;
break;
}
?>
It kinda did something coz the english drupal welcome page disappeared, but only the hungarian mission statement and and footer appears, no content, and a poll block is missing too. So I lost the content of my frontpage and the link remains /en in the address bar.
I tried another one:
<?php
$homeref = $_SERVER['HTTP_REFERER'];
$langref = parse_url($homeref, PHP_URL_PATH);
if ($langref = 'en') {
print node_page_default() '?q=hu';
?>
Same thing as above + an error message
Parse error: syntax error, unexpected '=' in /home/fetahu/public_html/new/includes/common.inc(1649) : eval()'d code on line 7
Someone please help, I really cannot dont know php. As soon as we find the solution for the front-page it will solve the other chat-page problem too. When the right code is found to redirect from 'en' to 'hu'. Will just have to add it to the chatroom's php embed code which at present is:
<?phpecho '<iframe width="100%" height="450" src="sites/all/modules/flashchat/flashchat.php"></iframe>';
?>
I'm making this site for our non-profit organization specialised on student counselling. Many thanks and eternal gratitude for any help.
#2
SOLVED!
At admin/settings/language/i18n it was set to:
Content selection mode:
Current language and language neutral.
just had to change it to
Mixed current language (if available) or default language (if not) and language neutral.
Now it is like what I wanted it to be.
#3