Here is the problem that I and many other Joomla 1.5.x users probably face:
I have assigned a different template (as the default) to a few menu-links, and I want to use Joomfish to change this template by another, when choosing a different language in the front-end of this template. As I can understand it, this can only be achieved by altering the index.php file of the above template (since using e.g. the free plug-in Yos this will assign a template for each language for the whole site and not only for the above mentioned e.g. menu links and the specified template).
The facts are:
1). In Joomla 1.0.x the solution is obvious, adding the following lines in the index.php (so that every template would be named by its standard name and a "-en" or "-de" etc. etc.):
- Code: Select all
// gets template for page
$cur_template = $mainframe->getTemplate();
// add this
if( $mosConfig_multilingual_support ) {
$cur_template .= "-". $iso_client_lang;
}
else {
$cur_template .= "-en";
}
2). But If you are using Joomla 1.5.x and want to switch templates this method will not work as the variable $mosConfig_lang is not valid to joomla 1.5.x.
In the free plug-in for Joomla 1.5.x, that assigns to every language selected in Joomfish a different template to and for the whole website, the php code looks like these:
- Code: Select all
<?php
jimport( 'joomla.plugin.plugin' );
class plgSystemEXAMPLE_jf_template extends JPlugin
{
function plgSystemEXAMPLE_jf_template(& $subject, $config)
{
parent::__construct($subject, $config);
}
function onAfterRoute(){
global $option, $mainframe;
if ($mainframe->isAdmin()) {
return; // Dont run in admin
}
$registry =& JFactory::getConfig();
$jfLang = $registry->getValue("joomfish.language", false);
if (!$lang) {
return;
}
$str_config = $this->params->get('template_config', '');
$str_config = preg_replace('/\s/', '', $str_config);
if (preg_match('/'. $lang->shortcode . '=>(((.*?),)|((.*?)$))/', $str_config, $match)) {
$newTemplate = $match[1];
$newTemplate = preg_replace('/,/', '', $newTemplate);
$mainframe->set('setTemplate', $newTemplate);
}
}
}
You can then in the back-end select and assign the templates for each language like this e.g. en=>ja_purity
(i.e. <params><param name="template_config" type="" size="" default="" label=""
description="shortcode=>template_code, separate by ','. EXAMPLE: en=>beez,de=>rhuk_milkyway,fr=>ja_purity" /></params>)
I would like to try to change and modify the above code in a way that it could be added directly into the index.php of a joomla template, but I am a novice at such things like Joomla plug-ins...
Can someone with the appropriate skills help and propose a solution on how to modify this code and add it in the index.php, so that we would be able to assign to and for a specified template different other templates for each language selected with Joomfish...
Or, in other words, is there a solution in Joomla 1.5.x on how to select a templated based on the language front-end switch adding lines in our index.php? In this way someone could "assign to each template a different template for each language selected" with Joom!Fish. Because with the free Yos plugin you can "assign to each language only one template" and for the whole site. To explain it simple, using the above code as plugin you can "assign to each language" (only) one template, but if you add this code in the index.php of each template then you are in the position to "assign to each template" (and not only to each language & the whole site) a different template for each language, that you select with Joom!Fish.
Can someone propose us which lines to add in the index.phpto achieve this? I opened also a thread about this in the Joomla Forum Language under: http://forum.joomla.org/viewtopic.php?f=485&t=387806
The questions to summarize it all that still remains for many Joomla 1.5.x and Joom!Fish users are: which exactly lines to add in the index.php to assign a template for each language selected in the front-end??? and if this is possible to be implemented in Joomla 1.5.x like it was in Joomla 1.0.x?
Thanks in advance for any further help,
I'm not even sure if I posted in the right Forum in Joom!Fish my question?
Regards, Styl
