Keyword

"VIEW ITEMS" and the problem

  • Tarun Das
  • Tarun Das's Avatar Topic Author
  • Offline
  • Junior Member
More
10 years 3 months ago #129515 by Tarun Das
"VIEW ITEMS" and the problem was created by Tarun Das
Hi.

I have two categories
1. Bird Sanctuaries
2. Bird Species

I changed K2_VIEW_ITEMS="View destinations" in en-GB.com_k2.ini for Bird Sanctuaries because it's a destination. Now I have a problem. In the second category also (Bird Species) it's showing 'View destinations'. Kind of very awkward because it's a living thing. How can I change that to "View species" instead? Your help will be highly appreciated.

I can understand that en-GB.com_k2.ini settings are global.

Thanks
Tarun

Joomla! 3.4.3, K2 v2.6.9 (Eagerly waiting for v3)
Website: Yankee Russia

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
10 years 3 months ago #129516 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: "VIEW ITEMS" and the problem
Hello Tarun.

Are you referring to the front end or the backend?

If you are referring to the front end then you need to do the following.
You have to use template overrides for these. You need to create a new K2 template for the category with the different language strings.

This post will help you:
nuevvo.com/blog/item/84-k2-inheritance-sub-templating

Finally all you need to is to change "K2_VIEW_ITEMS" to what you want it to be,

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

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

  • Tarun Das
  • Tarun Das's Avatar Topic Author
  • Offline
  • Junior Member
More
10 years 3 months ago - 10 years 3 months ago #129517 by Tarun Das
Replied by Tarun Das on topic Re: "VIEW ITEMS" and the problem
Thank you krikor, as I said earlier, you are the real K2 GURU, you always solved my problems way easier than I thought it would be. My problem is solved. You can mark this post as SOLVED. I would like to list together the whole procedure I had to go through. Two reasons, first, I think there people who are facing the same problem as I did and this will make their life easier and that way serve the real purpose of a support forum. Second, I have a selfish reason for this, I am not a programmer and it’s guaranteed that I would forget the whole process in days to come, LOL. So this listing will serve as a reference manual for me. Oh, here is a third reason … you can point me out if I did not do everything correctly. :)

1. Read the whole article referred by Krikor.

2. Went to the root folder of my Joomla root (i.e. public_html), and then ‘templates’ folder and there I found my joomla template folder, I will describe it as ‘MY_JOOMLA_TEMPLATE_FOLDER’

3. Created a folder ‘html’ inside ‘MY_JOOMLA_TEMPLATE_FOLDER’, and then created another folder ‘com_k2’ further inside the ‘html’ folder. After that my folder structure looked like this … templates/ MY_JOOMLA_TEMPLATE_FOLDER/html/com_k2

4. Then I had to create my K2 template folder inside that com_k2 folder. This folder name would act and appear as K2 template name in Joomla backend so I named it ‘bird’. After that my folder structure looked like this … templates/ MY_JOOMLA_TEMPLATE_FOLDER/html/com_k2/bird

5. Up to that point everything was simple … then I needed to find out which file(s) from the main K2 template (i.e. /components/com_k2/templates/default) should be copied in the ‘bird’ folder. Because only the file(s) that would be modified needed to copied. So I was searching for a file or files that link the language file (in this case en-GB.com_k2.ini). Krikor did not mention about it. After a lot of Google search and frustrations I figured out in my case it was ‘category.php’ that links the en-GB.com_k2.ini. So finally I copied ‘category.php’ file in the ‘bird’ folder.

6. A text search of the language string K2_VIEW_ITEMS in ‘category.php’ revealed that it’s on line number 114. Changed <?php echo JText::_('K2_VIEW_ITEMS'); ?> to <?php echo JText::_('K2_VIEW_BIRDS'); ?> and saved.

7. Inserted a new line in ‘en-GB.com_k2.ini’ with text string K2_VIEW_BIRDS="View species" just after the line K2_VIEW_ITEMS="View destinations" and saved.


Thank you again.
Tarun

Joomla! 3.4.3, K2 v2.6.9 (Eagerly waiting for v3)
Website: Yankee Russia

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
10 years 3 months ago #129518 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: "VIEW ITEMS" and the problem
Heheh thank you for your kind words.
And I really appreciate you posting the solution so other users can benefit as well.

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

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

More
10 years 1 month ago #129519 by Henrik Persson
Replied by Henrik Persson on topic Re: "VIEW ITEMS" and the problem
I am quite new to both Joomla and K2. I am in the same situation as you: In essence I want to create a new key ( like your K2_VIEW_BIRDS) and I have read your solution with interest.

But if I have understood it correctly, your solution will break next time you update K2. Correct me if I am wrong.

So I have tried another approach: The Language Manager can be used to override texts, but not to create new ones - at least I couldn't find a way. So I created an override for the K2 key, I wanted to replace by another. Then I opened the file generated by the Language Manager and changed the name of the key so it matched the name I use in my K2 template. (If you already have an override file, just add a new entry in it).

Since this key is not defined anywhere else, it is technically not an override. But it works nonetheless. And it should persist through an update of K2.

/henrik

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

  • Tarun Das
  • Tarun Das's Avatar Topic Author
  • Offline
  • Junior Member
More
10 years 1 month ago - 10 years 1 month ago #129520 by Tarun Das
Replied by Tarun Das on topic Re: "VIEW ITEMS" and the problem
You are right. It won't survive an upgrade.
Above post was my first approach ... later I made an override.

Extension>Language Manager>Overrides>New
Search for the Key you want to override in Search Box and it will creat a override for you , you just have to change the text and save. That's all

Joomla! 3.4.3, K2 v2.6.9 (Eagerly waiting for v3)
Website: Yankee Russia

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


Powered by Kunena Forum