CMSimple XH version 1.7.2 Search [Workaround and Extention]
Posted: Mon Nov 05, 2018 10:57 am
This is a workoraund for the highlight bug in search function (viewtopic.php?f=10&t=14178|) in CMSimple XH version 1.7.2 ONLY.
Instead of inserting extra tags to highlight search results, keywords are highlighted with javascript.
Now, when I started correcting the search function, I also expanded the class Search in file Serch.php in core CMSimple with sorted results list.
Sorted result list has the following order:
1 exact match
2 All keywords are found on the page
3 only some keywords are found on the page
And finally, if search has only one result, the extended version redirects to the actual page with keywords instead of displaying a result page with link to the page. This work fine with javascript highlights as javascript scroll the page to the first hit.
Changes to the core code will of course be overwritten by the next update of CMSimple XH. By that time, I hope that the the bug is corrected and that the development team implements the extension to the search function itself. The development team is of course welcome to use my code.
Followed files are changed:
tlpfunc.php
Search.php
Download: https://simplesolutions.dk/?SearchHi
Instead of inserting extra tags to highlight search results, keywords are highlighted with javascript.
Now, when I started correcting the search function, I also expanded the class Search in file Serch.php in core CMSimple with sorted results list.
Sorted result list has the following order:
1 exact match
2 All keywords are found on the page
3 only some keywords are found on the page
And finally, if search has only one result, the extended version redirects to the actual page with keywords instead of displaying a result page with link to the page. This work fine with javascript highlights as javascript scroll the page to the first hit.
Changes to the core code will of course be overwritten by the next update of CMSimple XH. By that time, I hope that the the bug is corrected and that the development team implements the extension to the search function itself. The development team is of course welcome to use my code.
Followed files are changed:
tlpfunc.php
Search.php
Download: https://simplesolutions.dk/?SearchHi