|
|
Assign Template to CB
|
|
Date: 2006/04/11 15:28
|
By: spikec
|
Status:
|
|
|
Karma: 13  
|
|
Senior Joomlapolitan  | Posts: 81 |   | |
|
Has anyone figured out a hack that will allow assignment of a template to the entire CB component? I understand how joomla is menu driven, and you can only assign a template to a specific menu item...blah blah blah. Right now I can assign my desired template to the parts of CB that have a menu link, but when for example, you click on a members avatar (or any other part of the CB component that you can't tie to a menu item), it goes to the user's profile but reverts to the default template.
It seems to me a simple "if/else" condition in the joomla index.php (around line 195) might do he trick, as in :
if ( $option='com_comprofiler') $template='desired template'; else $cur_template = $mainframe->getTemplate();
I've tried this several different ways, but no workie, probably because my syntax is wrong. Seems to me that this would be an easy way to get around the whole assigning templates mess.... Any thoughts?
Post edited by: spikec, at: 2006/04/11 09:29
|
|
The topic has been locked. |
|
|
|
|
Re:Assign Template to CB
|
|
Date: 2006/05/11 16:08
|
By: TheAnt
|
Status: User
|
|
|
Karma: 0  
|
|
Fresh Joomlapolitan  | Posts: 2 |   | |
|
Please, I need this too. Help us!!
|
|
The topic has been locked. |
|
|
|
|
Re:Assign Template to CB
|
|
Date: 2006/05/20 01:09
|
By: rex339
|
Status: User
|
|
|
Karma: 0  
|
|
Junior Joomlapolitan  | Posts: 25 |   | |
|
this looks interesting
|
|
The topic has been locked. |
|
|
|
Re:Assign Template to CB
|
|
Date: 2006/05/20 18:59
|
By: dave
|
Status:
|
|
|
Karma: 3  
|
|
Junior Joomlapolitan  | Posts: 33 |   | |
|
I have had the following script in my index file for a long time - it works great.
In index.php, find the following:
| Code: | // loads template file
if ( !file_exists( 'templates/'. $cur_template .'/index.php' ) ) {
echo _TEMPLATE_WARN . $cur_template;
|
Add Something like the following before the above code:
| Code: | //template hack
if($option == 'com_comprofiler')
{
$cur_template = 'template1';}
elseif($option == 'com_content' && $task == 'blogcategory' && $id == '1' && $Itemid == '131')
{
$cur_template = 'template2';}
|
That is it. You can get this to work at the componant level or even down to a specific page. You can have unlimited elsif statements - I have about 12.
Post edited by: dave, at: 2006/05/20 13:00
|
|
The topic has been locked. |
|
|
|
Re:Assign Template to CB
|
|
Date: 2006/05/20 21:13
|
By: spikec
|
Status:
|
|
|
Karma: 13  
|
|
Senior Joomlapolitan  | Posts: 81 |   | |
|
|
That is awesome! I read over at joomla.org that assigning a template to a component could not be done. I had been using a workaround of using the desired CB template as the default template, and assigning the real default template to everything else. I appreciate you sharing this!
|
|
The topic has been locked. |
|
|
|
Re:Assign Template to CB
|
|
Date: 2006/07/20 07:55
|
By: renoa
|
Status: User
|
|
|
Karma: 0  
|
|
Fresh Joomlapolitan  | Posts: 1 |   | |
|
omg it works!! thank you very much you have no idea how much i suffered from this
|
|
The topic has been locked. |
|
|