Page 1 of 2

Redirection to the Start Page (MLE)

Posted: Thu Sep 04, 2008 8:24 am
by rediska
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)

Posted: Thu Sep 04, 2008 9:32 am
by alby
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.
What is redirect_lang tag? of lang tag?

Alby

Re: Redirection to the Start Page (MLE)

Posted: Thu Sep 04, 2008 9:33 am
by christiaans
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
 
I had noticed redirect_lang isn't working for me either!

Re: Redirection to the Start Page (MLE)

Posted: Thu Sep 04, 2008 9:36 am
by alby
chris-s wrote: I had noticed redirect_lang isn't working for me either!
What is redirect_lang ?

Alby

Re: Redirection to the Start Page (MLE)

Posted: Thu Sep 04, 2008 9:37 am
by christiaans
alby wrote:
chris-s wrote: I had noticed redirect_lang isn't working for me either!
What is redirect_lang ?

Alby
The UDT tag to be used when content == "" to redirect to another page??

Re: Redirection to the Start Page (MLE)

Posted: Thu Sep 04, 2008 9:50 am
by alby
chris-s wrote: The UDT tag to be used when content == "" to redirect to another page??
Arrghh!!!

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)  ;D

Alby

Re: Redirection to the Start Page (MLE)

Posted: Thu Sep 04, 2008 9:52 am
by christiaans
alby wrote:
chris-s wrote: The UDT tag to be used when content == "" to redirect to another page??
Arrghh!!!

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)  ;D

Alby
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?

Re: Redirection to the Start Page (MLE)

Posted: Thu Sep 04, 2008 10:27 am
by alby
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']);
}

with  to='alias_of_page_to_redirect'

Alby

Re: Redirection to the Start Page (MLE)

Posted: Thu Sep 04, 2008 2:16 pm
by rediska
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.

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);

Re: Redirection to the Start Page (MLE)

Posted: Thu Sep 04, 2008 3:00 pm
by alby
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)

Posted: Sun Sep 07, 2008 7:01 pm
by rediska
hm, doesn't work.. ???

Re: Redirection to the Start Page (MLE)

Posted: Sun Sep 07, 2008 8:40 pm
by alby
rediska wrote: hm, doesn't work.. ???
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

Alby

Re: Redirection to the Start Page (MLE)

Posted: Fri Sep 12, 2008 7:33 am
by christiaans
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
Hello alby,

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']);
}
Then in my template I added:

Code: Select all

{content assign='maincontent'}
{if $maincontent eq ''}{not_available to="home"}{else}{$maincontent}{/if}
But nothing happens. I think it is because the "if $maincontent eq ''" isn't working! How can I fix this?

Re: Redirection to the Start Page (MLE)

Posted: Fri Sep 12, 2008 7:44 am
by alby
chris-s wrote: Then in my template I added:

Code: Select all

{content assign='maincontent'}
{if $maincontent eq ''}{not_available to="home"}{else}{$maincontent}{/if}
But nothing happens. I think it is because the "if $maincontent eq ''" isn't working! How can I fix this?
Hummm, I tested and worked
Check with:

Code: Select all

{content assign='maincontent'}
{if $maincontent eq ''}maincontent eq ''{else}maincontent neq '': {$maincontent}{/if}
I have a patch for this but it's untested.
In this weekend I look

Alby

Re: Redirection to the Start Page (MLE)

Posted: Fri Sep 12, 2008 8:17 am
by christiaans
alby wrote:
chris-s wrote: Then in my template I added:

Code: Select all

{content assign='maincontent'}
{if $maincontent eq ''}{not_available to="home"}{else}{$maincontent}{/if}
But nothing happens. I think it is because the "if $maincontent eq ''" isn't working! How can I fix this?
Hummm, I tested and worked
Check with:

Code: Select all

{content assign='maincontent'}
{if $maincontent eq ''}maincontent eq ''{else}maincontent neq '': {$maincontent}{/if}
I have a patch for this but it's untested.
In this weekend I look

Alby
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.