Redirection to the Start Page (MLE)
Redirection to the Start Page (MLE)
Hi!
Is it possible to configure a redirection to the start page when clicking an a language flag?
For example...the visitor is on the english site "about me" clicks on the french flag and is redirected to the french start page.
I tried to achieve that by changing the redirect_lang tag. But in the 1.3 version this tag seems not to work at all.At least It's changing doesn't affect anything.
Thank You!
Alex
Is it possible to configure a redirection to the start page when clicking an a language flag?
For example...the visitor is on the english site "about me" clicks on the french flag and is redirected to the french start page.
I tried to achieve that by changing the redirect_lang tag. But in the 1.3 version this tag seems not to work at all.At least It's changing doesn't affect anything.
Thank You!
Alex
Re: Redirection to the Start Page (MLE)
What is redirect_lang tag? of lang tag?rediska wrote: I tried to achieve that by changing the redirect_lang tag. But in the 1.3 version this tag seems not to work at all.At least It's changing doesn't affect anything.
Alby
-
- Power Poster
- Posts: 300
- Joined: Tue Mar 04, 2008 10:37 am
Re: Redirection to the Start Page (MLE)
I had noticed redirect_lang isn't working for me either!rediska wrote: Hi!
Is it possible to configure a redirection to the start page when clicking an a language flag?
For example...the visitor is on the english site "about me" clicks on the french flag and is redirected to the french start page.
I tried to achieve that by changing the redirect_lang tag. But in the 1.3 version this tag seems not to work at all.At least It's changing doesn't affect anything.
Thank You!
Alex
Re: Redirection to the Start Page (MLE)
What is redirect_lang ?chris-s wrote: I had noticed redirect_lang isn't working for me either!
Alby
-
- Power Poster
- Posts: 300
- Joined: Tue Mar 04, 2008 10:37 am
Re: Redirection to the Start Page (MLE)
The UDT tag to be used when content == "" to redirect to another page??alby wrote:What is redirect_lang ?chris-s wrote: I had noticed redirect_lang isn't working for me either!
Alby
Re: Redirection to the Start Page (MLE)
Arrghh!!!chris-s wrote: The UDT tag to be used when content == "" to redirect to another page??
It's very old and I tried in mle <= 1.2.3
You must use b. version of Tips #9 (now is automatic with a flag)

Alby
-
- Power Poster
- Posts: 300
- Joined: Tue Mar 04, 2008 10:37 am
Re: Redirection to the Start Page (MLE)
But the problem is (at least in my case), that I don't want to display the default lang, I want to redirect to default or homepage for this lang, would that still be possible, with a different UDT perhaps?alby wrote:Arrghh!!!chris-s wrote: The UDT tag to be used when content == "" to redirect to another page??
It's very old and I tried in mle <= 1.2.3
You must use b. version of Tips #9 (now is automatic with a flag)
Alby
Re: Redirection to the Start Page (MLE)
chris-s wrote: But the problem is (at least in my case), that I don't want to display the default lang, I want to redirect to default or homepage for this lang, would that still be possible, with a different UDT perhaps?
UNTESTED (for 1.4+)
redirect_to:
Code: Select all
if (! empty($params['to']))
{
redirect_to_alias($params['to']);
}
Alby
Re: Redirection to the Start Page (MLE)
Hi Alby,
where should this code be put in?
thanx!
Btw: that's how my redirect_lang tag looks. But as i said it ain't working.
where should this code be put in?
thanx!
Btw: that's how my redirect_lang tag looks. But as i said it ain't working.
Code: Select all
global $gCms;
global $hls, $hl;
if ( (! empty($params['lang'])) && (array_key_exists($hls, $params['lang'])) )
$hl = $params['lang'];
else
$hl = DEFAULT_LANG;
if (! empty($params['to'])) $alias = $params['to'];
else
{
$pageinfo =& $gCms->variables['pageinfo'];
$alias = $pageinfo->content_id;
}
$config = &$gCms->GetConfig();
$contentops =& $gCms->GetContentOperations();
$contentobj = $contentops->LoadContentFromAlias( $alias );
if($config['assume_mod_rewrite'])
{
if($config['use_hierarchy'] == true) $_end_url_part = $contentobj->HierarchyPath().(isset($config['page_extension'])?$config['page_extension']:'.html');
else $_end_url_part = $alias .(isset($config['page_extension'])?$config['page_extension']:'.html');
$link_url = $config['root_url'].'/index.php/'.$params['lang'].'/'.'home';
}
else
{
if(isset($_SERVER['PHP_SELF']) && $config['internal_pretty_urls'] == true)
{
if($config['use_hierarchy'] == true) $_end_url_part = $contentobj->HierarchyPath().(isset($config['page_extension'])?$config['page_extension']:'.html');
else $_end_url_part = $alias .(isset($config['page_extension'])?$config['page_extension']:'.html');
$link_url = $config['root_url'].'/index.php/'.$params['lang'].'/'.'home';
}
else
{
$link_url = $config['root_url'].'/index.php/'.$params['lang'].'/'.'home';
}
}
redirect($link_url);
Last edited by rediska on Thu Sep 04, 2008 2:37 pm, edited 1 time in total.
Re: Redirection to the Start Page (MLE)
rediska wrote: where should this code be put in?
thanx!
Btw: that's how my redirect_lang tag looks. But as i said it ain't working.
Try to replace redirect_lang code with my redirect_to code and try to call (or use b case):
{redirect_lang to='try_with_one_alias'}
Alby
Re: Redirection to the Start Page (MLE)
hm, doesn't work.. 

Re: Redirection to the Start Page (MLE)
Have you replace your code and use un real 'try_with_one_alias' (with 1.3.1 you can to have problem with default page: page with / only)?rediska wrote: hm, doesn't work..![]()
I check and work
Alby
-
- Power Poster
- Posts: 300
- Joined: Tue Mar 04, 2008 10:37 am
Re: Redirection to the Start Page (MLE)
Hello alby,Have you replace your code and use un real 'try_with_one_alias' (with 1.3.1 you can to have problem with default page: page with / only)?
I check and work
I just checked if it worked, but it didn't for me.
What I did was:
Create a new UDT (called it: not_available) with:
Code: Select all
if (! empty($params['to']))
{
redirect_to_alias($params['to']);
}
Code: Select all
{content assign='maincontent'}
{if $maincontent eq ''}{not_available to="home"}{else}{$maincontent}{/if}
Re: Redirection to the Start Page (MLE)
Hummm, I tested and workedchris-s wrote: Then in my template I added:But nothing happens. I think it is because the "if $maincontent eq ''" isn't working! How can I fix this?Code: Select all
{content assign='maincontent'} {if $maincontent eq ''}{not_available to="home"}{else}{$maincontent}{/if}
Check with:
Code: Select all
{content assign='maincontent'}
{if $maincontent eq ''}maincontent eq ''{else}maincontent neq '': {$maincontent}{/if}
In this weekend I look
Alby
-
- Power Poster
- Posts: 300
- Joined: Tue Mar 04, 2008 10:37 am
Re: Redirection to the Start Page (MLE)
Okay, thanks for taking the effort. I tried this, however, it still doesn't work for me. I think the problem still lays in the fact that the "content" tag isn't empty, and there it does render the $maincontent.alby wrote:Hummm, I tested and workedchris-s wrote: Then in my template I added:But nothing happens. I think it is because the "if $maincontent eq ''" isn't working! How can I fix this?Code: Select all
{content assign='maincontent'} {if $maincontent eq ''}{not_available to="home"}{else}{$maincontent}{/if}
Check with:I have a patch for this but it's untested.Code: Select all
{content assign='maincontent'} {if $maincontent eq ''}maincontent eq ''{else}maincontent neq '': {$maincontent}{/if}
In this weekend I look
Alby