- Posts: 63
COMMUNITY FORUM
- Forum
- Commercial Joomla Extensions & Templates
- Commercial Joomla Templates
- Search results on an specific Search page
Please note that official support for commercial extensions & templates is provided in the Subscriber Help Desk.
Support requests should ONLY be directed there and require an active subscription plan.
This forum board is to be used for archive purposes and knowledge exchange ONLY.
Support requests should ONLY be directed there and require an active subscription plan.
This forum board is to be used for archive purposes and knowledge exchange ONLY.
Search results on an specific Search page
- Felipe
- Topic Author
- Offline
- Senior Member
Less
More
10 years 7 months ago #138483
by Felipe
Search results on an specific Search page was created by Felipe
Hi again,
Using Search module (K2 Tools module), on kiji_Search position, I need my search results to go to an specific Search page, already created as a menu item, instead of showing the search results on the homepage, which is happening now.
I followed every config from the demo site without success on this matter.
Regards,
Felipe Z.
Using Search module (K2 Tools module), on kiji_Search position, I need my search results to go to an specific Search page, already created as a menu item, instead of showing the search results on the homepage, which is happening now.
I followed every config from the demo site without success on this matter.
Regards,
Felipe Z.
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
10 years 7 months ago #138484
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Search results on an specific Search page
This is quite tricky.
The search layout does not have a separate view (menu item) so it will render through the current menu item.
This feature will be included in the next version of K2 but until then you can try this method:
Step 1: Create a new menu item
You first need to create a menu item for the results. For maintenance reasons and the sake of clarity I always create a search form or results menu item.
Hint: Leave the Search Term field empty.
Step 2: Copy its id
In this step you need to copy the menu item’s id. You can easily find its id since it is the last parameter in the URL.
Example: For a URL like site.com/administrator/index.php?option=com_menus&view=item&layout=edit&id=190 the id would be 190.
Step 3: The overriding part
If your template already has overrides for the K2 tools modules you can safely ignore this part.
If you read the K2 inheritance & sub-templating post by Yiota, you already know how easy it is to locate the files to override.
For those of you who didn’t read that post, this piece of documentation is quite helpful as well as Yiota’s post.
The K2 Tools module files are located in the /modules/mod_k2_tools/ folder and the file you need to override is search.php which is located inside the /modules/mod_k2_tools/tmpl/ folder.
Follow the same procedure which is described in these two posts and move this file in your template’s html/mod_k2_tools/ folder. Your final file structure should match the one in the following image.
Step 4: Now the coding (and final) part
As you might have already suspected, what we need to do is to make the form's action post in that particular menu item.
To achieve this you need to edit the form’s action attribute and append the menu item id you copied in step 2.
You need to change this line of code
Let me know if that worked.
The search layout does not have a separate view (menu item) so it will render through the current menu item.
This feature will be included in the next version of K2 but until then you can try this method:
Step 1: Create a new menu item
You first need to create a menu item for the results. For maintenance reasons and the sake of clarity I always create a search form or results menu item.
Hint: Leave the Search Term field empty.
Step 2: Copy its id
In this step you need to copy the menu item’s id. You can easily find its id since it is the last parameter in the URL.
Example: For a URL like site.com/administrator/index.php?option=com_menus&view=item&layout=edit&id=190 the id would be 190.
Step 3: The overriding part
If your template already has overrides for the K2 tools modules you can safely ignore this part.
If you read the K2 inheritance & sub-templating post by Yiota, you already know how easy it is to locate the files to override.
For those of you who didn’t read that post, this piece of documentation is quite helpful as well as Yiota’s post.
The K2 Tools module files are located in the /modules/mod_k2_tools/ folder and the file you need to override is search.php which is located inside the /modules/mod_k2_tools/tmpl/ folder.
Follow the same procedure which is described in these two posts and move this file in your template’s html/mod_k2_tools/ folder. Your final file structure should match the one in the following image.
Step 4: Now the coding (and final) part
As you might have already suspected, what we need to do is to make the form's action post in that particular menu item.
To achieve this you need to edit the form’s action attribute and append the menu item id you copied in step 2.
You need to change this line of code
<form action="<?php echo $action; ?>" method="get" autocomplete="off" class="k2SearchBlockForm">
<form action="<?php echo JRoute::_('index.php?option=com_k2&view=itemlist&task=search&Itemid=THE_MENU_ITEM_ID'); ?>" method="get" autocomplete="off" class="k2SearchBlockForm">
Let me know if that worked.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Felipe
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 63
10 years 7 months ago - 10 years 7 months ago #138485
by Felipe
Replied by Felipe on topic Search results on an specific Search page
Thanks Krikor, it worked!!
I have another problem now: the results page shows the whole article.
Several of my K2 categories don't have intro text; they are blog-like entries and I don't want intro text.
How can the search results page show only 25 or 30 words of every article?
I have the same problem with the front page. I need to include categories that don't have intro text but i can´t because it shows the whole article!
Regards,
Felipe Z.
I have another problem now: the results page shows the whole article.
Several of my K2 categories don't have intro text; they are blog-like entries and I don't want intro text.
How can the search results page show only 25 or 30 words of every article?
I have the same problem with the front page. I need to include categories that don't have intro text but i can´t because it shows the whole article!
Regards,
Felipe Z.
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
10 years 6 months ago #138486
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Search results on an specific Search page
Hello Felipe, I 'm glad it worked.
You need to read this post: getk2.org/community/English-K2-Community/192346-Show-featured-items-only-in-menu-page#192531
The file you need to change is located at templates/kiji/html/com_k2/default/category_item.php
You need to read this post: getk2.org/community/English-K2-Community/192346-Show-featured-items-only-in-menu-page#192531
The file you need to change is located at templates/kiji/html/com_k2/default/category_item.php
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Felipe
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 63
10 years 6 months ago - 10 years 6 months ago #138487
by Felipe
Replied by Felipe on topic Search results on an specific Search page
Krikor, I have spent several hours trying to fix this without any luck.
Even on those K2 forum posts seems that the solution proposed didn't fix the problem.
1. One problem is to limit the words of the articles when using more than one category (on the front page).
2. And the other problem is to limit the words of the articles on the search results page.
Please if you could help me with this it will be incredible.
Regards,
Felipe Z.
Part of the message is hidden for the guests. Please log in or register to see it.
Even on those K2 forum posts seems that the solution proposed didn't fix the problem.
1. One problem is to limit the words of the articles when using more than one category (on the front page).
2. And the other problem is to limit the words of the articles on the search results page.
Please if you could help me with this it will be incredible.
Regards,
Felipe Z.
Part of the message is hidden for the guests. Please log in or register to see it.
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
10 years 6 months ago #138488
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Search results on an specific Search page
This actually a matter of K2 actually, not the template.
You need to use that snippet to replace the introtext tags.
You need to replace
with
in both category_item.php in templates/kiji/html/com_k2/default/) and in
generic.php (in templates/kiji/html/com_k2/).
useThe same applies to the tag.php and user.php files
20 is the word limit. You can also experiment with characterLimit which limits the introtext to characters.
PS. Backup all your files.
PS 2. This will force the limit on all category views. It is better to create a new K2 template for the homepage with only the new category_item file inside it.
Read this, it will help you, read it before you do any changes: nuevvo.com/blog/item/84-k2-inheritance-sub-templating
PS 3. Have a great weekend.
You need to use that snippet to replace the introtext tags.
You need to replace
<?php echo $this->item->introtext; ?>
with
<?php echo K2HelperUtilities::wordLimit($this->item->introtext, 20); ?>
in both category_item.php in templates/kiji/html/com_k2/default/) and in
generic.php (in templates/kiji/html/com_k2/).
use
<?php echo K2HelperUtilities::wordLimit($item->introtext, 20); ?>
20 is the word limit. You can also experiment with characterLimit which limits the introtext to characters.
PS. Backup all your files.
PS 2. This will force the limit on all category views. It is better to create a new K2 template for the homepage with only the new category_item file inside it.
Read this, it will help you, read it before you do any changes: nuevvo.com/blog/item/84-k2-inheritance-sub-templating
PS 3. Have a great weekend.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Felipe
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 63
10 years 6 months ago #138489
by Felipe
Replied by Felipe on topic Search results on an specific Search page
Thanks again Krikor, it worked great.
(Maybe, the option to set word limit for K2 category menu item, tags, and users, are some good features for K2 future releases).
Is there a way to show tags (or users) on an specific page? Right now, if I click on one tag from the tag module (or one user from the K2 tools - authors list module), it goes to the frontpage...
Or should I open a new question to ask this?
Regards,
Felipe Z.
(Maybe, the option to set word limit for K2 category menu item, tags, and users, are some good features for K2 future releases).
Is there a way to show tags (or users) on an specific page? Right now, if I click on one tag from the tag module (or one user from the K2 tools - authors list module), it goes to the frontpage...
Or should I open a new question to ask this?
Regards,
Felipe Z.
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
10 years 6 months ago #138490
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Search results on an specific Search page
Not really, You need to set a base menu item so all orphan tags are rendered through that menu item.
Take a look at this thread: github.com/joomlaworks/k2/issues/133
Take a look at this thread: github.com/joomlaworks/k2/issues/133
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Felipe
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 63
10 years 6 months ago #138491
by Felipe
Replied by Felipe on topic Search results on an specific Search page
Incredible: so simple and effective! The solution even "override" our fix to search.php and now when clicking on tags, users or search module it goes to this "blank" menu item, which is excellent.
Felipe
Felipe
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
10 years 6 months ago #138492
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Search results on an specific Search page
I 'm happy it worked :)
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Forum
- Commercial Joomla Extensions & Templates
- Commercial Joomla Templates
- Search results on an specific Search page