• [Snippet] Little modification of FlexSearchForm#

  • MadeMyDay Reply #1, 6 years ago

    Reply
    Hi,

    I just modificated the FlexSearchForm a bit and think perhaps someone is interested in it My problem was that I built a site and didn´t fill out the description of the pages and so the search results are not that informative (as the results on the modxcms page). That was the first time I found something that joomla does better, so I transferred that functionality to modX.

    What it does: With displaying search results you´ll get an extract of the context with highlighted search term. Also multiple words are possible and are highlighted the google way
    See example here:

    www.mademyday.de/ifa

    Search for example for "familie" (german site), you will see what it does.

    In the snippet you can configure the variable $extract to either true or false, which will (surprise!) show the extract or not. There are two CSS classes used, FSF_extract for the div container with the extract and a span class called FSF_highlight for highlighting the text in this extract (yellow background in the example above)

    This is not the standard FSF, I translated some words and changed a few settings, but I think you guys will get it (no time to put in the standard FSF yet).

    Greetz Marc

    EDIT: New version with different colors for every phrase (FSF_highlight1, FSF_highlight2 etc.)


  • rthrash Reply #2, 6 years ago

    Reply
    OK so that absuletly rocks. We will most likely add this to the default core distribution... thanks!

    Any way to have it use an array of color definitions when putting in multi-item searches, like searching for "familie durch Doppel".


  • MadeMyDay Reply #3, 6 years ago

    Reply
    OK so that absuletly rocks. We will most likely add this to the default core distribution... thanks!

    You´re welcome, glad to give a little bit back to you guys
    Any way to have it use an array of color definitions when putting in multi-item searches, like searching for "familie durch Doppel".

    Don´t understand now, do you mean seperate definitions for the terms? E.g. "familie" in yellow, "doppel" in blue and so on? I´ll try

    Greetz Marc


  • rthrash Reply #4, 6 years ago

    Reply


  • MadeMyDay Reply #5, 6 years ago

    Reply
    No problem I think. What do you think is better: To highlight like some text bla bla text... or to define the colors in an array in the snippet itself? I would prefer to define highlight1-x in the CSS. (I already did that local, just have to highlight the search header like googel ).

    Greetz Marc


  • modx@mindspill.net Reply #6, 6 years ago

    Reply
    Thanks Marc, that's great, just what I was looking for.

    For anyone who wants English, here it is with all config back to the modx defaults.

    Steph


  • briggsys Reply #7, 6 years ago

    Reply
    Awesome, can't wait to get back from my few days away on courses and implement it.

    Had trouble with the original highlight option (think it was Sottwells) so be cool to bust this one out and have a go


  • MadeMyDay Reply #8, 6 years ago

    Reply
    Okay, here we go:

    www.mademyday.de/ifa

    Try with Ryan´s funny search "familie doppel durch" (means family double through ).

    Changed the attachement from the first post.

    @Steph: Would you be so kind to translate/set it back to standard, have to finish this site this night (we have 1 o´clock here) :-/

    Greetz Marc

    PS: I´m not a coder, this could surely be more properly, so if anyone likes to improve it... go on


  • rthrash Reply #9, 6 years ago

    Reply
    Nice work! You going to update the source and share for everyone here?


  • MadeMyDay Reply #10, 6 years ago

    Reply
    Changed the attachement from the first post.

    EDIT: New version with different colors for every phrase (FSF_highlight1, FSF_highlight2 etc.)