Closed (fixed)
Project:
Display Suite
Version:
7.x-1.2
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
21 Jul 2011 at 18:01 UTC
Updated:
16 Mar 2012 at 23:37 UTC
Jump to comment: Most recent file
Comments
Comment #1
swentel commentedWell, there's an option on the search configuration settings of ds (at admin/structure/ds/search) to highlight words in the text that is displayed. The search_excerpt function is not an option right now, but maybe we should create a field called 'search_excerpt' which does the same as the default search. If the first is good enough, I'll leave it as this, but I'm willing to investigate that extra field though.
Comment #2
technikh commentedI have that option checked but yet the search terms are not highlighted. You can see it here. http://relay7.technikh.com/?q=search/content/films
See the attached snapshot of my search settings.
In the page source I see that the javascript is loaded and when I uncheck that option it's not loaded.
do You think my jquery has some conflicts or is it the problem with my settings?
Comment #3
swentel commentedAah, you are using the teaser version of it seems for search results. You'll have to change the 'HTML selector' to something like .node-teaser so the javascrit kicks in. Can you check if that makes it work ? Maybe I'll need to update the descriptions a bit on the settings page to make this clear.
Comment #4
technikh commentedPerfect. It worked. http://relay7.technikh.com/?q=search/content/film Thanks.
How Can we do this in PHP instead of javascript? because in this case http://relay7.technikh.com/?q=search/content/swiss
I want to show extra information for the searched terms. like when I search for "swiss" which is a taxonomy term with fields, I want to show other field information of that particular taxonomy term
I was looking at search hooks like http://api.drupal.org/api/drupal/modules--node--node.api.php/function/ho... but didn't know where & how to use it
If my module can read the searched terms, I can manipulate & display the node teaser accordingly.
Any suggestions?
Comment #5
swentel commentedCan't you just add more fields in the search result view mode ?
Comment #6
technikh commentedI only want to show extra field information for searched terms. not all terms of the node.
because there may be like 100 terms to the node and if I show all field information for all terms the search result would be too long.
for this purpose my module needs to know the terms user searched for.
Comment #7
swentel commentedOne way todo this is using php and implementing hook_ds_fields_info() which enables you to create a field which content can be anything. The field will show up on Field UI to put into one of the regions of your layout. Look into ds.api.php for the function signature or into ds.ds_fields_info.inc for examples. The content can be a function which gets a lot of info in the function (field definition and the complete entity) and you can read the search term from the url (normally arg(2)) and you can do whatever PHP code in there to return the content you want. That's the easiest way to get the result you want I think.
Comment #8
technikh commentedI see. didn't thought of that "search term from the url". Thanks. that will work for me.
Comment #10
dadderley commented@swentel
Thanks for the tip.
Also, thanks for the whole Display Suite module.
It is pretty awesome.