Hi,
I got solution but this only temporary solutions.
because,every templates are loading from includes/application.php in
getTemplate($params = false).
Using this function only every templates loading,In this function it
will get each every current page template id and template name.
If we use setTemplate() function it won't work any more,because in
getTemplate($params = false) function template id and template name.
load directly from the database so it will set as per the database
requirements.
so,i thought to hack this getTemplate($params = false).
i added one function like this
function fetch_template($extn){ //$extn contains name of the
component (3rd party extension component)
if($extn!=""){
$db = &JFactory::getDBO();
$select = "select * from #__menu where menutype='mainmenu'";
$db->setQuery($select); $result = $db->loadObjectlist();
foreach($result as $result){
if (preg_match("/\b$extn\b/i", "$result->link")) {
if($result->template_style_id!=0){
$select = "select * from #__menu where menutype='main'";
$db->setQuery($select); $result_ideal = $db-
>loadObjectlist();
foreach($result_ideal as $result_ideal){
$id = $result_ideal->id;
}
}
}
}
}
}return $result_ideal->id;
}
In getTemplate():
I add $com = JRequest::getVar('option');
if($com == "com_abcde"){
$post= JRequest::get('post');
$extn = $post['extn']; //extn is a variable i passes in post.
$id = $this->fetch_template($extn);//$extn you have post the 3rd
party extension and also change the template ID
//using this $id,you can fetch the template name from the
templat_style table
if (isset($templates[$id])) {
$template = $templates[$id];
}
else {
$template = $templates[0];
}
// Allows for overriding the active template from the request
$template->template = JRequest::getCmd('template', $template-
>template);
$template->template = JFilterInput::getInstance()->clean($template-
>template, 'cmd'); // need to filter the default value as well
// Fallback template
if (!file_exists(JPATH_THEMES . '/' . $template->template . '/
index.php')) {
JError::raiseWarning(0, JText::_('JERROR_ALERTNOTEMPLATE'));
$template->template = 'beez_20';
if (!file_exists(JPATH_THEMES . '/beez_20/index.php')) {
$template->template = '';
}
}
}
that's it !
I got it form above hack,now i can set each template for a each
component (Not only the main menu).
On Nov 8, 9:40 pm, Hannes Papenberg <
hackwa...@googlemail.com> wrote:
> I don't understand you fully, but I'm guessing that you are missing the
> ItemID at some point in your URLs. Without that ItemID, Joomla does not
> know whichtemplateto use and uses the defaulttemplatefor the site.
>
> Hannes
>
> Am 08.11.2011 05:49, schrieb gopi gopi:
>
>
>
>
>
>
>
> > In Joomla1.7,we cansetthe different templates for a number
> > ofcomponent.
>
> > Like i am using 3component....
>
> > Iseta Atomic - Default
> > <
http://adodis.in/gopi/ccidealplatform210/administrator/index.php?opti...>template
> > for 'AAA -Component'
>
> > then iseta Beez5 - Default-Fruit Shop
> > <
http://adodis.in/gopi/ccidealplatform210/administrator/index.php?opti...>template
> > for 'BBB -Component'.
>
> > then Beez2 - Parks Site
> > <
http://adodis.in/gopi/ccidealplatform210/administrator/index.php?opti...>template
> > for 'CCC -component'.
>
> > We canset differenttemplateby using menu manager only but i am
> > intermediate mycomponentto othercomponentinternally.
>
> > I havesetatemplatefor 'AAA -component'( Atomic - Default
> > <
http://adodis.in/gopi/ccidealplatform210/administrator/index.php?opti...> ) while
> > i am intermediate thecomponentof 'BBB -component' it's changed into
> > defaulttemplate(Beez2 - Default
> > <
http://adodis.in/gopi/ccidealplatform210/administrator/index.php?opti...>).