- Posts: 16
COMMUNITY FORUM
Template used when displaying by tag
- Robert Broughton
-
Topic Author
- Offline
- New Member
Less
More
15 years 4 days ago #83130
by Robert Broughton
Template used when displaying by tag was created by Robert Broughton
On my site, I'm displaying articles both by category and by tag.When displaying by category, I've chosen a custom template in the category setup, and everything works fine. See, for example, thecanadian.org/k2-video However, when displaying by tag, there isn't an opportunity to select a custom template, so I get the K2 default template instead. See thecanadian.org/stories/transportation-urban-planningThe best way to to this would be to provide a place to select the template when you create the k2 -> Itemlisting -> tag menu item.
Please Log in or Create an account to join the conversation.
- Robert Broughton
-
Topic Author
- Offline
- New Member
Less
More
- Posts: 16
15 years 3 days ago #83131
by Robert Broughton
Replied by Robert Broughton on topic Template used when displaying by tag
I've figured out a "sort of solution" for this.
I altered the file com_k2/views/itemlist/view.html.php. Line 161 of this file is:
$this->setLayout('generic');
I changed it to:
$this->setLayout('tag');
Then, I copied the category.php file for my custom template to tag.php, and category_item.php to tag_item.php. Had to make some changes, mainly commenting out all the "if" statements that apply to categories.
I altered the file com_k2/views/itemlist/view.html.php. Line 161 of this file is:
$this->setLayout('generic');
I changed it to:
$this->setLayout('tag');
Then, I copied the category.php file for my custom template to tag.php, and category_item.php to tag_item.php. Had to make some changes, mainly commenting out all the "if" statements that apply to categories.
Please Log in or Create an account to join the conversation.
- Simon Wells
-
- Offline
- Platinum Member
Less
More
- Posts: 955
15 years 3 days ago #83132
by Simon Wells
Replied by Simon Wells on topic Template used when displaying by tag
Hi Robert, that would be one way of doing it, but it affects your core files and so would be lost when upgrading K2.
If you have setup your new K2 templates correctly, you will have also copied the generic.php, which sits one level up from your new k2 template.
The only restriction, is that it will then over ride the default, but be common to all new K2 templates you create.
Hope that gives an idea.
Also, check out my blog post regarding modifying the Tag results page.
Simon
K2 Support
If you have setup your new K2 templates correctly, you will have also copied the generic.php, which sits one level up from your new k2 template.
The only restriction, is that it will then over ride the default, but be common to all new K2 templates you create.
Hope that gives an idea.
Also, check out my blog post regarding modifying the Tag results page.
Simon
K2 Support
Please Log in or Create an account to join the conversation.
- Taco Kist
-
- Offline
- New Member
Less
More
- Posts: 3
14 years 10 months ago #83133
by Taco Kist
Replied by Taco Kist on topic Template used when displaying by tag
Hi Robert,
Your solution is really good! I'm using it right now for the same problem, but i'm not handy with code. Is it possible that you send me your tag.php and tag_item.php so i can use them?
Thanks,
Taco
Your solution is really good! I'm using it right now for the same problem, but i'm not handy with code. Is it possible that you send me your tag.php and tag_item.php so i can use them?
Thanks,
Taco
Please Log in or Create an account to join the conversation.