- Posts: 4
COMMUNITY FORUM
Is there a correct way to override view.html.php?
- Chris Cage
- Topic Author
- Offline
- New Member
Less
More
12 years 6 months ago #64161
by Chris Cage
Is there a correct way to override view.html.php? was created 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
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.
- Nico Eshuis
- Offline
- New Member
Less
More
- Posts: 9
12 years 6 months ago - 12 years 6 months ago #64162
by Nico Eshuis
Replied by Nico Eshuis on topic Re: Is there a correct way to override view.html.php?
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.
- Chantal
- Offline
- New Member
Less
More
- Posts: 2
12 years 3 months ago #64163
by Chantal
Replied by Chantal on topic Re: Is there a correct way to override view.html.php?
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
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.
- Lefteris
- Offline
- Moderator
Less
More
- Posts: 8743
12 years 3 months ago #64164
by Lefteris
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Lefteris on topic Re: Is there a correct way to override view.html.php?
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.
- Chantal
- Offline
- New Member
Less
More
- Posts: 2
12 years 3 months ago #64165
by Chantal
Replied by Chantal on topic Re: Is there a correct way to override view.html.php?
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
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.