Redirection to the Start Page (MLE)

This is a FORK of the CMS Made Simple project and is not oficially supported in any way by the CMS Made Simple development team.
rediska
New Member
New Member
Posts: 3
Joined: Wed Sep 03, 2008 8:05 am

Redirection to the Start Page (MLE)

Post 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
 
alby

Re: Redirection to the Start Page (MLE)

Post 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
christiaans
Power Poster
Power Poster
Posts: 300
Joined: Tue Mar 04, 2008 10:37 am

Re: Redirection to the Start Page (MLE)

Post 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!
alby

Re: Redirection to the Start Page (MLE)

Post by alby »

chris-s wrote: I had noticed redirect_lang isn't working for me either!
What is redirect_lang ?

Alby
christiaans
Power Poster
Power Poster
Posts: 300
Joined: Tue Mar 04, 2008 10:37 am

Re: Redirection to the Start Page (MLE)

Post 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??
alby

Re: Redirection to the Start Page (MLE)

Post 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
christiaans
Power Poster
Power Poster
Posts: 300
Joined: Tue Mar 04, 2008 10:37 am

Re: Redirection to the Start Page (MLE)

Post 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?
alby

Re: Redirection to the Start Page (MLE)

Post 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
rediska
New Member
New Member
Posts: 3
Joined: Wed Sep 03, 2008 8:05 am

Re: Redirection to the Start Page (MLE)

Post 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);
Last edited by rediska on Thu Sep 04, 2008 2:37 pm, edited 1 time in total.
alby

Re: Redirection to the Start Page (MLE)

Post 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
rediska
New Member
New Member
Posts: 3
Joined: Wed Sep 03, 2008 8:05 am

Re: Redirection to the Start Page (MLE)

Post by rediska »

hm, doesn't work.. ???
alby

Re: Redirection to the Start Page (MLE)

Post 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
christiaans
Power Poster
Power Poster
Posts: 300
Joined: Tue Mar 04, 2008 10:37 am

Re: Redirection to the Start Page (MLE)

Post 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?
alby

Re: Redirection to the Start Page (MLE)

Post 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
christiaans
Power Poster
Power Poster
Posts: 300
Joined: Tue Mar 04, 2008 10:37 am

Re: Redirection to the Start Page (MLE)

Post 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.
Locked

Return to “[locked] CMSMS MLE fork”