Author Topic: FIX: Search Term Highlighting (.css)  (Read 7919 times)

Offline mjm4842

  • Posts: 198
FIX: Search Term Highlighting (.css)
« on: September 29, 2010, 06:31:40 AM »
In reference to the following Website Baker documentation for enabling Search Term Highlighting:
http://www.websitebaker2.org/en/help/designer-guide/enhanced-template-elements.php#anker2

PLEASE NOTE: The information contained below requires you to make a change to a core WebsiteBaker file. As such, upgrading to a new version of WebsiteBaker will result in this fix being overwritten unless the recommended change is incorporated into future versions of WebsiteBaker.

This may have worked back in WB 2.6.7 however, after hours of trying to get this to work, it turns out that this search term highlighting functionality is no longer implemented in the current version of WebsiteBaker. From what I gather, it seems that the search feature used to call the search_highlight function located in framework/frontend.functions.php. I am not sure when it happened. however after scanning all of the WebsiteBaker source code, I can no longer find any code in WebsiteBaker that makes a call to this function.

To restore this functionality, you must edit the following line of code which is located in the prepare_excerpts function of the search/search_modext.php file:

Was:

   $EXCERPT_MARKUP_START = '<b>';

Should be changed to:

   $EXCERPT_MARKUP_START = '<b class="highlight">';

Once you have saved these changes, be sure to follow the instructions mentioned in the above link to correctly configure your CSS.

That's it. From that point on, the words used in search terms will be highlighted according to your CSS style.

Note: If you decide not to implement any customization to your CSS code, the change described above will not have any noticeable effect.

OFFICIAL REQUEST: I would like to request that the above fix for restoring the documented functionality be included in future versions of WebsiteBaker.

With warmest regards,

Michael Milette
Frustrated? Spending too much time developing when all you really want is a working website? Contact me directly if I can be of services to you.
___________________ ________


www.tngconsulting.c a

Offline thorn

  • Posts: 980
  • Gender: Male
    • Projects
Re: FIX: Search Term Highlighting (.css)
« Reply #1 on: September 29, 2010, 05:16:06 PM »
Hello,

the highlighting-code is still present and functional in framework/frontend_functions.php -- but is applied only to "real" pages. Matches on the search-result page are not highlighted this way. Instead static <b>-tags are used.

Do you want to apply the same highlighting style to the search-result-page?


thorn.

Edit: the function is called in page_content() in same file.
« Last Edit: September 29, 2010, 05:18:39 PM by thorn »

Offline mjm4842

  • Posts: 198
Re: FIX: Search Term Highlighting (.css)
« Reply #2 on: September 29, 2010, 05:42:57 PM »
Hi Thorn,

Thank you for your feedback and your question. It was most enlightening and appreciated.

Based on the instructions, I assumed that Search Term Highlighting meant that the search term would be highlighted in the results of a search. Thanks to your comments, I now understand and see that the search terms are indeed highlighted on the actual page when you click on a link in the search results page.

I guess this changes my request from being a bug fix to being a feature request, just to make things consistent. If you don't think it is a good idea, then I would like to suggest that the documentation be amended so that people like myself don't make a false assumption about their expectations.

By the way, I am somewhat embarrased and would like to apologize for not noticing that the search_highlight function was being called within the same file. I searched all the source code but failed to scroll down and notice it was right there within the same file. My mistake.

With warmest regards,

Michael
« Last Edit: September 29, 2010, 05:45:35 PM by mjm4842 »
Frustrated? Spending too much time developing when all you really want is a working website? Contact me directly if I can be of services to you.
___________________ ________


www.tngconsulting.c a

 

postern-length