- Posts: 9
COMMUNITY FORUM
Problem overriding generic search/date layout
- Nico Eshuis
-
Topic Author
- Offline
- New Member
I've been stuck with this for a week now. I can't seem to override generic.php in components/com_k2/templates/generic.php. First I tried to do it the MVC way via my template but that didn't work. Now, I'm hacking into the component and that doesn't even work. My assumption is that it gets overridden somewhere else. I've bought and installed a k2 filter module and I can't seem to find any overrides there, the rest of my joomla/k2 installation is standard. Maybe it's just a silly newbie mistake but I can't figure it out.
Any thoughts on this?
Any help would be appreciated!
Many thanks in advance
Please Log in or Create an account to join the conversation.
- william white
-
- Offline
- Platinum Member
- Posts: 3722
create the directory
yoursiteroot/templates/beez20/html/com_k2/templates
copy the file
YourSiteRoot/components/com_k2/templates/generic.php to the newly created directory
Open the newly created file and edit at lines 54 and 58 and put something link
override /components/com_k2/templates/generic.php after the >
Create the search module for k2 and test it
Please Log in or Create an account to join the conversation.
- Kelsey Brookes
-
- Offline
- Elite Member
Your suggested path layout seems to contradict this templating tutorial:
getk2.org/documentation/tutorials/item/174-templating-with-k2-and-the-concepts-of-sub-templates
So I'm now a little stumped!
Please Log in or Create an account to join the conversation.
- Lefteris
-
- Offline
- Platinum Member
- Posts: 8743
Please Log in or Create an account to join the conversation.
- Kelsey Brookes
-
- Offline
- Elite Member
I've got quite a few overrides going (by duplicating the /default directory to mytemplate/html/com_k2/new-override) but I've tried making adjustments to generic.php without success.
I've put generic.php in mytemplate/html/com_k2/generic.php, made changes, uploaded - no changes on the site.
I've put generic.php in mytemplate/html/com_k2/templates/generic.php, made changes, uploaded - no changes on the site.
I've even tried making changes to components/com_k2/templates/generic.php - no changes on the site
Given that all my other overrides for K2 are working just fine, this is driving me kinda just a little bit nuts!
Please Log in or Create an account to join the conversation.
- Lefteris
-
- Offline
- Platinum Member
- Posts: 8743
Please Log in or Create an account to join the conversation.
- Kelsey Brookes
-
- Offline
- Elite Member
Thanks for responding, sorry it's taken a little while to get back to this.
I've been testing out the system and still cannot get it to work.
I'm attaching a few screenshots so you can see what I'm talking about:
File 1 - you can see that 'generic.php' is in the proper place, along with a set of other (fully working) overrides)
File 2 - you can see I've added in the class 'test-to-see-if-overrides-working' in addition to the existing 'genericItemView' class.
File 3 - a code sample from the live site. You can see that the additional class is not being inserted
The one thing I've not managed to 100% understand in your reply was the requirement of an ItemID.
It *does* have an itemId, here's the relative URL:
"index.php/component/k2/itemlist/filter?searchword1=Speaker&searchword2=&searchword3=&searchword4=&Itemid=101"
But there's no way I can see to create an actual menu item to list generated by searching on extra field attributes? Because this is the output I'm trying to style. As you can see from the code samples, it is most definitely being derived from generic.php - it's just refusing to be overriden.
Thanks again, your continued help is appreciated.
Please Log in or Create an account to join the conversation.
- Lefteris
-
- Offline
- Platinum Member
- Posts: 8743
Please Log in or Create an account to join the conversation.
- Kelsey Brookes
-
- Offline
- Elite Member
If it wasn't, the classes of all the results would not start with 'genericItem---'.
And the code layout on the page exactly matches generic.php, so it's definitely being derived from that view.
Please Log in or Create an account to join the conversation.
- Lefteris
-
- Offline
- Platinum Member
- Posts: 8743
Please Log in or Create an account to join the conversation.
- Kelsey Brookes
-
- Offline
- Elite Member
Please Log in or Create an account to join the conversation.
- Nathalie
-
- Offline
- New Member
- Posts: 1
I'm experiencing the same problem, but only with use of K2 Filter and Search module.
Using the K2 Tools, all goes well.
I've just updated K2 to the latest version, K2 Filter and Search module is version 1.4.6
Please Log in or Create an account to join the conversation.
- Kelsey Brookes
-
- Offline
- Elite Member
Please Log in or Create an account to join the conversation.
- Kelsey Brookes
-
- Offline
- Elite Member
The filter and search module, while using the generic.php template, is not respecting template overrides.
I've contacted the developer about this and will update with any news.
Please Log in or Create an account to join the conversation.
- Yayoi Moriguchi
-
- Offline
- New Member
- Posts: 1
Any information would be much appreciated.
Please Log in or Create an account to join the conversation.
- Andrey Miasoedov
-
- Offline
- Senior Member
This issue is happened because generic.php in K2 Filter and Search module is renamed to filter.php
The search results template is located in
plugins\system\k2filter\K2Filter\templates\filter.php
You can override it in your template path :
templates\your_template\html\com_k2\filter.php
Please Log in or Create an account to join the conversation.
- Lefteris
-
- Offline
- Platinum Member
- Posts: 8743
Thanks for sharing this.
Please Log in or Create an account to join the conversation.
- AdrianK
-
- Offline
- Senior Member
- Posts: 46
Lefteris Kavadas wrote: place the generic.php file at /templates/YOUR_SITE_TEMPLATE/html/com_k2/templates/generic.php
Yes, thank you very much!
Please Log in or Create an account to join the conversation.