- Posts: 8
COMMUNITY FORUM
k2.js override - is it possible?!
- Marinel Cuculj
-
Topic Author
- Offline
- New Member
Less
More
10 years 8 months ago #131462
by Marinel Cuculj
k2.js override - is it possible?! was created by Marinel Cuculj
Hi,
K2 is awesome, especially when you use overrides and make crazy templates of your own :)
I know that overrides work with /com_k2/views/items and so on... as discussed in many topics... but I am interested is there a way to override the files from the /media folder?!
I have done some hacks in k2.js file... just a few lines... but it would be more elegant to put it in override if is possible!
Thanks :)
K2 is awesome, especially when you use overrides and make crazy templates of your own :)
I know that overrides work with /com_k2/views/items and so on... as discussed in many topics... but I am interested is there a way to override the files from the /media folder?!
I have done some hacks in k2.js file... just a few lines... but it would be more elegant to put it in override if is possible!
Thanks :)
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
Less
More
- Posts: 15920
10 years 8 months ago #131463
by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: k2.js override - is it possible?!
You can override it just like k2.css.
Simply copy it in a js folder in your template.
Simply copy it in a js folder in your template.
Please Log in or Create an account to join the conversation.
- Marinel Cuculj
-
Topic Author
- Offline
- New Member
Less
More
- Posts: 8
10 years 8 months ago #131464
by Marinel Cuculj
Replied by Marinel Cuculj on topic Re: k2.js override - is it possible?!
Well... i tried... but no luck. Here is what I try to do...
In backend I added override for item.php (I put it in /administrator/tamplates/MY_TEMPLATENAME/html/com_k2/items/default.php) and it works like a charm. In that file I added a new TAB, that is displayed only on specific category, and here is where the /media/k2/assets/js/k2.js folder comes in... so, no matter if I put this file in /administrator/tamplates/MY_TEMPLATENAME/js/ or in /tamplates/MY_TEMPLATENAME/js/ the result is the same, Joomla is loading this file /media/k2/assets/js/k2.js and not override.
If I put the code in the /media/k2/assets/js/k2.js it works. So the code is OK :)
What I am doing wrong?
And one more quesstion... is it possible to override view.html.php file? If yes, how? :)
For example this one: /administrator/components/com_k2/views/item/view.html.php
Thanks :)
In backend I added override for item.php (I put it in /administrator/tamplates/MY_TEMPLATENAME/html/com_k2/items/default.php) and it works like a charm. In that file I added a new TAB, that is displayed only on specific category, and here is where the /media/k2/assets/js/k2.js folder comes in... so, no matter if I put this file in /administrator/tamplates/MY_TEMPLATENAME/js/ or in /tamplates/MY_TEMPLATENAME/js/ the result is the same, Joomla is loading this file /media/k2/assets/js/k2.js and not override.
If I put the code in the /media/k2/assets/js/k2.js it works. So the code is OK :)
What I am doing wrong?
And one more quesstion... is it possible to override view.html.php file? If yes, how? :)
For example this one: /administrator/components/com_k2/views/item/view.html.php
Thanks :)
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
Less
More
- Posts: 15920
10 years 8 months ago #131465
by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: k2.js override - is it possible?!
The view.html.php can't be overriden.
You will have to backup your edits before you update and then reapply them.
Sorry about the js file. It was possible on older versions of K2. As of the latter versions it cannot be overriden. You can unset it ( getk2.org/community/English-K2-Community/180963-How-to-unset-k2js ) and load your own version.
You will have to backup your edits before you update and then reapply them.
Sorry about the js file. It was possible on older versions of K2. As of the latter versions it cannot be overriden. You can unset it ( getk2.org/community/English-K2-Community/180963-How-to-unset-k2js ) and load your own version.
Please Log in or Create an account to join the conversation.
- Marinel Cuculj
-
Topic Author
- Offline
- New Member
Less
More
- Posts: 8
10 years 2 months ago #141198
by Marinel Cuculj
Replied by Marinel Cuculj on topic Re: k2.js override - is it possible?!
Hi,
You link to how to unset K2JS is not working... can you provide a good one?
Thanks! :)
You link to how to unset K2JS is not working... can you provide a good one?
Thanks! :)
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
Less
More
- Posts: 15920
10 years 2 months ago #141267
by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: k2.js override - is it possible?!
Please Log in or Create an account to join the conversation.