Hi all!
first of all thanks for this great job, I know that is quite hard to maintain a big piece of software like this, congrats!
well, my doubt is that I have 2 templates and 2 languages, but I really don't know where to assign a template to a language. If I change the languate to a page it will change to the other language correctly, having allways the same language for the template.
How can I assign a template to a lang?
spanish pages -> spanish template
catalan pages -> catalan template
I hope you understand my non-academic-non-native english.
thanks!
Different languages, different templates. how?
Re: Different languages, different templates. how?
Use one template for all languages
Usually translations can be used in one template, also use of "$lang" variable modifier allows you to use different pictures, forms for each language.
I am not sure what exactly you are trying to accomplish.
Code: Select all
{if $lang==es_ES}
{arrange_items_for_Spanish_taste}
{elseif $lang==ca_ES}
{arrange_items_for_Catalan_taste}
{/if}
I am not sure what exactly you are trying to accomplish.
Re: Different languages, different templates. how?
Maybe your solution solve my problem, but, what I'm trying to do is:
- have two templates, each for every language
- assign each template to every language
- be happy![wink ;-)](./images/smilies/wink.gif)
I'm searching the database for the template_id config and it assigns a unique template_id for page, that's not a good point to start.
Now I'm studing the code of class.pageinfo.inc.php to know from where it gets the template_id ($onepageinfo->template_id = $row['template_id'];, line 161 or $pi->template_id = $data['template_id'];, line 104). If I can add a new table in the database i can assign a languate to each template and then obtain an especific template for language.
Another solution is to use a unique template (the option that you says).
reggards and thanks!![Smiley :)](./images/smilies/smiley.gif)
- have two templates, each for every language
- assign each template to every language
- be happy
![wink ;-)](./images/smilies/wink.gif)
I'm searching the database for the template_id config and it assigns a unique template_id for page, that's not a good point to start.
Now I'm studing the code of class.pageinfo.inc.php to know from where it gets the template_id ($onepageinfo->template_id = $row['template_id'];, line 161 or $pi->template_id = $data['template_id'];, line 104). If I can add a new table in the database i can assign a languate to each template and then obtain an especific template for language.
Another solution is to use a unique template (the option that you says).
reggards and thanks!
![Smiley :)](./images/smilies/smiley.gif)
Re: Different languages, different templates. how?
Here is my modification of the code to get multilang on templates:
Modify database:
Assign the languages manually: (volunteer to code the admin for this?)
Open and edit:
Edit:
And add at bottom of the parent code:
then:
Now, we modify this lines with the next ones:
/* MODIFY WITH THIS */
Modify database:
Code: Select all
ALTER TABLE `cms_templates` ADD `mle_lang` VARCHAR( 255 ) NOT NULL
Code: Select all
UPDATE cms_templates SET mle_lang = 'esp' WHERE template_id = 17; //exaple for lang 'esp' , with ID 17
UPDATE cms_templates SET mle_lang = 'cat' WHERE template_id = 19; //example for lang 'cat' with ID 19
Code: Select all
path_to_website/lib/classes/class.pageinfo.inc.php
#$Id: class.pageinfo.inc.php 115 2009-08-04 16:42:12Z alby $
Code: Select all
//Start MLE
global $mleblock, $mleblockfallback;
Code: Select all
$mle_lang = &$gCms->smarty->compile_id;
Code: Select all
//Start MLE
global $mleblock, $mleblockfallback;
$mle_lang = &$gCms->smarty->compile_id;
Now, we modify this lines with the next ones:
Code: Select all
//Start MLE
$query = "SELECT {$mlequery} c.content_id, c.content_alias, c.hierarchy, c.id_hierarchy, c.prop_names, c.create_date AS c_create_date, c.modified_date AS c_date, c.cachable, c.last_modified_by, t.template_id, t.encoding, t.modified_date AS t_date FROM ".cms_db_prefix()."templates t INNER JOIN ".cms_db_prefix()."content c ON c.template_id = t.template_id WHERE (c.content_alias = ? OR c.content_id = ?) AND c.active = 1";
//End MLE
$row = &$db->GetRow($query, array($alias, $alias));
}
else
{
//Start MLE
$query = "SELECT {$mlequery} c.content_id, c.content_alias, c.hierarchy, c.id_hierarchy, c.prop_names, c.create_date AS c_create_date, c.modified_date AS c_date, c.cachable, c.last_modified_by,t.template_id, t.encoding, t.modified_date AS t_date FROM ".cms_db_prefix()."templates t INNER JOIN ".cms_db_prefix()."content c ON c.template_id = t.template_id WHERE c.content_alias = ? AND c.active = 1";
//End MLE
/* MODIFY WITH THIS */
Code: Select all
//Start MLE
if($mle_lang!=''){
$query = "SELECT {$mlequery} c.content_id, c.content_alias, c.hierarchy, c.id_hierarchy, c.prop_names, c.create_date AS c_create_date, c.modified_date AS c_date, c.cachable, c.last_modified_by, t.template_id, t.encoding, t.modified_date AS t_date FROM ".cms_db_prefix()."templates t INNER JOIN ".cms_db_prefix()."content c ON t.mle_lang = '$mle_lang' WHERE (c.content_alias = ? OR c.content_id = ?) AND c.active = 1";
}else{
$query = "SELECT {$mlequery} c.content_id, c.content_alias, c.hierarchy, c.id_hierarchy, c.prop_names, c.create_date AS c_create_date, c.modified_date AS c_date, c.cachable, c.last_modified_by, t.template_id, t.encoding, t.modified_date AS t_date FROM ".cms_db_prefix()."templates t INNER JOIN ".cms_db_prefix()."content c ON c.template_id = t.template_id WHERE (c.content_alias = ? OR c.content_id = ?) AND c.active = 1";
}
//End MLE
$row = &$db->GetRow($query, array($alias, $alias));
}
else
{
//Start MLE
if($mle_lang!=''){
$query = "SELECT {$mlequery} c.content_id, c.content_alias, c.hierarchy, c.id_hierarchy, c.prop_names, c.create_date AS c_create_date, c.modified_date AS c_date, c.cachable, c.last_modified_by,t.template_id, t.encoding, t.modified_date AS t_date FROM ".cms_db_prefix()."templates t INNER JOIN ".cms_db_prefix()."content c ON t.mle_lang = '$mle_lang' WHERE c.content_alias = ? AND c.active = 1";
}else{
$query = "SELECT {$mlequery} c.content_id, c.content_alias, c.hierarchy, c.id_hierarchy, c.prop_names, c.create_date AS c_create_date, c.modified_date AS c_date, c.cachable, c.last_modified_by,t.template_id, t.encoding, t.modified_date AS t_date FROM ".cms_db_prefix()."templates t INNER JOIN ".cms_db_prefix()."content c ON c.template_id = t.template_id WHERE c.content_alias = ? AND c.active = 1";
}
//End MLE
Re: Different languages, different templates. how?
Have you read tips 5-7 on http://forum.cmsmadesimple.org/index.ph ... 318.0.html ?
{news category="Home-$lang" .....other params....}
I would use different templates only if structure (not text or images) of pages of different languages differ by 50% and over. Can you post your templates to forum ?Use TranslationManager module!
Re: Different languages, different templates. how?
Hi!
My templates are both equal, only difference is text.
I have readed few posts of the forum and the documentation and I don't found that you told me.
Thanks for the point, but I have now the problem solved with that patch.
reggards!
My templates are both equal, only difference is text.
I have readed few posts of the forum and the documentation and I don't found that you told me.
Thanks for the point, but I have now the problem solved with that patch.
reggards!
Re: Different languages, different templates. how?
If the only difference is text you don't need to do anything...