Using HOME override in a multilingual site

Ali Majdzadeh K... - January 10, 2009 - 13:30
Project:Front Page
Version:6.x-1.2
Component:User interface
Category:bug report
Priority:normal
Assigned:Dublin Drupaller
Status:closed
Description

Hello
I don't know whether this is a bug or a feature request. Well, I am using this module in a multilingual site. I have created a splash page which is actually a flash animation. Also, I have created a static HTML page so that when users pass the front page, they visit the static page (which serves as a TOC) and then they enter the main site. I have overridden the HOME link in a way that it points to the static page. By the way, the main site is multilingual and uses path prefix for language detection (English: www.example.com, Persian: www.example.com/fa). The problem is that the overridden HOME link does not work when viewing the site in Persian, because I think that the redirect address is something global and there is no way to set something like www.example.com/fa/static.html as the redirect address for the HOME link of the Persian site.
It would be great if it was possible to declare different redirect addresses for different enabled languages.
Any ideas?

Kind Regards
Ali Majdzadeh Kohbanani

#1

Dublin Drupaller - January 10, 2009 - 15:41
Assigned to:Anonymous» Dublin Drupaller

Hi Ali,

The way the home breadcrumb override works in the front page.module is it checks for the domain referer (http_referer). That's obviously not enough for your purposes...you need to check the PATH as well.

What you can do is create a more advanced front_page (with the PHP filter switched on) and switch off your HOME breadcrumb override.

So your new front page will not only check where the visitor came from, uing http_referer...but it will also check to see what the PHP_URL_PATH is and display content in the correct language based on that.

In other words, if you check the referrer of a person clicking on a HOME link normally (without using the front page home breadcrumb links override) the link will look something like this: www.example.com/fa/node/67 where PHP_URL_PATH = 'fa' and 67 is the node they were looking at.

Here's a quick snippet that might help you in the right direction

<?php
if isset($_SERVER['HTTP_REFERER']) { // check to see if there was a referer url

 
$homeref = $_SERVER['HTTP_REFERER'];  // check where the visitor came from

 
$langref = parse_url($homeref, PHP_URL_PATH); // check which language path was in the referer url

 
if ($langref = 'fa') {
       print
"Persian content";
     }

  else {
       print
"English content"; // defaults to english contrent
    
}
else {
   
drupal_goto($path = 'node/1'); // redirect direct links to node/1
  
}
?>

hope that helps

dub

#2

Ali Majdzadeh K... - January 10, 2009 - 18:23

Dub,
Hi
Thanks a lot for your response. I am going to give it a try. Thanks again.

Kind Regards
Ali Majdzadeh Kohbanani

#3

Dublin Drupaller - November 24, 2009 - 08:47
Status:active» closed
 
 

Drupal is a registered trademark of Dries Buytaert.