• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS Made Simple Czech CMS Made Simple France CMS Made Simple Spain CMS Made Simple Hungary CMS Made Simple Russia CMS Made Simple Netherlands

All times are UTC




Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 
Author Message
 Post subject: [SOLVED] Help modifying {lang} tag
PostPosted: Wed May 05, 2010 4:52 pm 
Offline
New Member

Joined: Wed Jun 03, 2009 10:12 am
Posts: 8
Hi

I am the guy working on the multilanguage - multidomain site.

I have the {lang} tag showing flags at the bottom of the page. Presently if a browser clicks on a flag it goes to the correct language version, but the domain stays the same, so the browser can be viewing the Dutch language site but on the .co.uk domain.

I would like to modify the {lang} tag so that it adds a domain reference to the flags. So the dutch flag would have www..nl added to the link.

Can anyone point me to where the {lang} tag is located so that I can modify it.

Thanks

Peter


Last edited by peterfarrington on Wed May 12, 2010 10:24 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Help modifying {lang} tag
PostPosted: Wed May 05, 2010 5:55 pm 
Offline
Power Poster
Power Poster
User avatar

Joined: Thu May 14, 2009 8:11 pm
Posts: 1269
Location: Lithuania
{lang} is ordinary CMSms plugin. You can find it on '/plugins/function.lang.php'

_________________
My best friends are: FAQ: How can I debug my code/site ?...showtemplate=false...module_customhow to create a patch, {process_pagedata}
And Yours ? :)


Top
 Profile  
 
 Post subject: Re: Help modifying {lang} tag
PostPosted: Thu May 06, 2010 11:13 pm 
Offline
New Member

Joined: Wed Jun 03, 2009 10:12 am
Posts: 8
Thanks for the pointer.

I have modified the plugin, or rather created a copy and modified it. I am creating a url over the various flags which picks up the correct domain name. So the German flag has...

http://www..de/index.php?page=projects&hl=de_DE

and the French flag has...

http://www..eu/index.php?page=projects&hl=fr_FR

But the problem I am finding is that when the browser reaches that page it automatically redirects to...

http://www..de/index.php?page=home&hl=de_DE etc

So it always goes to the home page, and then I can browse the German site fine.

But the URL in the {lang} plugin looks fine.

Can anyone suggest where this redirection is taking place?

Thanks

Peter


Top
 Profile  
 
 Post subject: Re: Help modifying {lang} tag
PostPosted: Sat May 08, 2010 8:29 am 
Offline
Power Poster
Power Poster
User avatar

Joined: Thu May 14, 2009 8:11 pm
Posts: 1269
Location: Lithuania
Attach plugin you modified to your next message.
Also you will have to modify your tag if you want to upgrade to CMSms-1.7.1-mle-fork (it is being tested ATM).

_________________
My best friends are: FAQ: How can I debug my code/site ?...showtemplate=false...module_customhow to create a patch, {process_pagedata}
And Yours ? :)


Top
 Profile  
 
 Post subject: Re: Help modifying {lang} tag
PostPosted: Wed May 12, 2010 9:58 am 
Offline
New Member

Joined: Wed Jun 03, 2009 10:12 am
Posts: 8
Thanks for your continuing assistance.

I have copied the {lang} tag and created a new one called {lang2} so that I didn't mess anything up with the vanilla installation.

i. I added a line in config_lang which provides a site address for each language. So an excerpt is ...

'text'=>'English',
'site'=>'http://www.waterloo.co.uk',
'locale'=>'en_US.UTF-8'

ii. I modified a small section of the function.lang2.php file.

if($contentobj->DefaultContent() && get_site_preference('root_url_default_content',0))
{
$_url = $config['root_url'].'/?hl=';
}
else
{
$_url = $config['root_url'].'/index.php?'.$config['query_var'].'='.$alias.'&hl=';
}
foreach($hls as $key=>$mle)
{
//if(!in_array($key, $lang_ready)) continue;
$arr_mle[$key] = $mle;
if($hl == $key) $arr_mle[$key]['current'] = true;

$_url2 = $arr_mle[$key]['site'].'/index.php?'.$config['query_var'].'='.$alias.'&hl=';


$arr_mle[$key]['link'] = (!empty($params['urlparam'])) ? $_url.$key.$params['urlparam'] : $_url2.$key;

}


This produces the correct url when I look at the page source. For instance...

http://www..co.uk/newsite/index.php?page=news&hl=en_UK

But as I reported. When I go to this address it automatically redirects to the home page. The .htaccess in the CMSMS root directory is only setting PHP memory limits etc and does no redirection. If I just cut and paste the URL it also goes to the home page.

Is this because I am changing domain and language?

Any suggestions will be very gratefully received. I thought I was nearly there.

Peter


Top
 Profile  
 
 Post subject: [SOLVED] Help modifying {lang} tag
PostPosted: Wed May 12, 2010 10:16 am 
Offline
New Member

Joined: Wed Jun 03, 2009 10:12 am
Posts: 8
Forgive my stupidity.

I now realise, after many hours of staring at the screen, that I was linking the flags to the root of the site and not to the subdirectory where I have had to install CMSMS. In the root there is a script that checks the domain and redirects to the home page if someone has just entered the bare domain name, and so this was being called.

I have now modified my copy of {lang} so that it goes to the correct subdirectory and it is working fine.

What I need to do now, having got all the flags showing all of the time (which is what the client wants) is to grey out and not link those language variants which do not have content.

Thanks

Peter


Top
 Profile  
 
 Post subject: Re: [SOLVED] Help modifying {lang} tag
PostPosted: Wed May 12, 2010 11:35 am 
Offline
Power Poster
Power Poster
User avatar

Joined: Thu May 14, 2009 8:11 pm
Posts: 1269
Location: Lithuania
This is basic query to check if content is not empty. You should use right $temp_mleblock for each language
Quote:
global $gCms;
$db = $gCms->GetDb();
$db_reslut = $db->Execute('SELECT `content` ,`prop_name`
FROM `'.cms_db_prefix().'content`, `'.cms_db_prefix().'content_props`
WHERE `content_alias` = ? AND '.cms_db_prefix().'content.content_id='.cms_db_prefix().'content_props.content_id AND '.cms_db_prefix().'content_props.content'.$temp_mleblock.' IS NOT NULL  AND '.cms_db_prefix().'content_props.content <> ""', array($page_alias));
if($db_result) return TRUE; //content not empty
else return FALSE; // content empty

_________________
My best friends are: FAQ: How can I debug my code/site ?...showtemplate=false...module_customhow to create a patch, {process_pagedata}
And Yours ? :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Arvixe - A CMSMS Partner