Keyword

Problem overriding generic search/date layout

  • Nico Eshuis
  • Nico Eshuis's Avatar Topic Author
  • Offline
  • New Member
More
12 years 5 months ago #65113 by Nico Eshuis
Hi,

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.

More
12 years 5 months ago #65114 by william white
Replied by william white on topic Re: Problem overriding generic search/date layout
Assume your using beez20 template
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.

More
12 years 3 months ago #65115 by Kelsey Brookes
Replied by Kelsey Brookes on topic Re: Problem overriding generic search/date layout
I'm also having a problem overriding the generic.php file. Nothing I do seems to successfully override generic.php, while I'm quite able to create multiple templates for everything else by duplicating and renaming the default folder.

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.

More
12 years 3 months ago #65116 by Lefteris
Hi. the generic.php layout is used just for date and search listings since tag listings and user listings have their own layouts. So if you are in the context of generic.php you just need to copy the file to your Joomla! template folder and OUTSIDE of your K2 template. So putting generic.php under /templates/YOUR_SITE_TEMPLATE/html/com_k2/generic.php should do the trick.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

More
12 years 3 months ago #65117 by Kelsey Brookes
Replied by Kelsey Brookes on topic Re: Problem overriding generic search/date layout
That's what I thought - and yet it's not working.

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.

More
12 years 3 months ago #65118 by Lefteris
Just tested under Joomla! 2.5.6 with no issues. I assume that you are under the latest stable version of K2 ( 2.5.7 currently ). Also if the page you are viewing carries an Itemid ( menu alias ) then ensure that you have not placed other instances of generic.php into K2 template overrides. The generic.php is not meant to be overriden in K2 templates.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

More
12 years 2 months ago #65119 by Kelsey Brookes
Replied by Kelsey Brookes on topic Re: Problem overriding generic search/date layout
Hi there,

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.
Attachments:

Please Log in or Create an account to join the conversation.

More
12 years 2 months ago #65120 by Lefteris
What kind of link is the index.php/component/k2/itemlist/filter?searchword1=Speaker&searchword2=&searchword3=&searchword4=&Itemid=101? This is not coming from K2. In any case, if the rendered page is coming from K2 then the overrides will work. You need to understand the context of the page. If your page is a category view you need to override the category.php not the generic.php.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

More
12 years 2 months ago #65121 by Kelsey Brookes
Replied by Kelsey Brookes on topic Re: Problem overriding generic search/date layout
It's being generated by search - but you can see from the code samples that the results are definitely being generated by generic.php.

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.

More
12 years 2 months ago #65122 by Lefteris
Looking at the URL i assume that you have hacked K2 files to fit your needs or you use another extension for searching. If this is the case, i cannot provide support to modified code or third-party extensions ( it may be anything causing this ). If however this is not the case try again to place the generic.php file at /templates/YOUR_SITE_TEMPLATE/html/com_k2/generic.php or /templates/YOUR_SITE_TEMPLATE/html/com_k2/generic.php or /templates/YOUR_SITE_TEMPLATE/html/com_k2/templates/generic.php

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum