Here is my modification of the code to get multilang on templates:
Modify database:
Code: Select all
ALTER TABLE `cms_templates` ADD `mle_lang` VARCHAR( 255 ) NOT NULL
Assign the languages manually: (volunteer to code the admin for this?)
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
Open and edit:
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 $
Edit:
Code: Select all
//Start MLE
global $mleblock, $mleblockfallback;
And add at bottom of the parent code:
Code: Select all
$mle_lang = &$gCms->smarty->compile_id;
then:
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