Keyword

Is there a correct way to override view.html.php?

  • Chris Cage
  • Chris Cage's Avatar Topic Author
  • Offline
  • New Member
More
12 years 6 months ago #64161 by Chris Cage
Is there a best practice if we need to edit code within /com_k2/views/item/view.html.php and /com_k2/views/itemlist/view.html.php?

It doesn't seem like the template overrides mentioned here are meant to override view.html.php.

We needed to add code to handle some extended sub-category functionality and when we upgraded K2, it of course overwrote our modifications.

Any advice would be appreciated.

Chris

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

More
12 years 6 months ago - 12 years 6 months ago #64162 by Nico Eshuis
I'm wondering how this works too, I've bought a filter plugin that takes me to the itemlist view but then the formatting is different from my custom category.php template. I would like to display them in the same way.

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

More
12 years 3 months ago #64163 by Chantal
Did any of you figure this out yet?
I'd like to make some changes to the meta tags in view.html.php to get all the html5 tags correct and to add facebook properties.
I'd rather not change the source file though..

Regards/ groeten,
Chantal

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

More
12 years 3 months ago #64164 by Lefteris
Hi. You can place any code you would place in view.html.php into the template overrides. Another more professional and also more complex way is to write plugins.

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 #64165 by Chantal
Hi Lefteris,

I already tried the override thing but the problem is that the change is not required in a template override of file \components\com_k2\\views\item\tmpl\item.php file, but one level up:
\components\com_k2\views\item\view.html.php (note that it's not a file in the tmpl folder).

Adding the SetMetaData scripts and addCustomTag in a view override is not working. I tried importing the joomla application component view also but that didn't help either. I also prefer not to put such coding in the direct output view script so I guess I'll have to edit the core or create a plugin then :pinch: .

Thanks for the tip about the plugin :).
If you know of any plugins that I can look into as an example, I'd be happy to hear: that would save me a lot of time.

Regards,
Chantal

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


Powered by Kunena Forum