Is there search results displaying option?

boardwalkboardwalk New
edited September 2014 in Vanilla 2.0 - 2.8

When I search something, I have results with lots of big images. (in case I search the posts that containing images)

and it makes search results pretty much ugly to see.

I just want to see results with "title + some content text" is so enough. As simple list.

But, I cannot find any options for do this. Is there any way to control it?

By the way, I tried to set Sphinx to have advanced search engine, but I don't think my host allows Sphinx.

Then I tried to replace with google CSE, but I don't know why my site can't get search results. (I think I put the URL right...)

So.. Back to the built in search engine, I want to know there is control option for search result displaying.

Thank you in advance.

Comments

  • You can override the Condense($Html) function and strip out the images. You need to place the override in your bootstrap.

    Alternatively, you could hook into SearchController_BeforeItemContent_Handler($Sender) and modify the $Sender->EventArguments['Row']->Summary field.

  • @hgtonight said:
    You can override the Condense($Html) function and strip out the images. You need to place the override in your bootstrap.

    Alternatively, you could hook into SearchController_BeforeItemContent_Handler($Sender) and modify the $Sender->EventArguments['Row']->Summary field.

    Wow... I think you gave me a solution very quick.
    but would you explain easier? :wink: I don't get it... I'm a so newbie.

  • Try a simple css solution: .search-results .ImgExt img {width: 100px}

    That might be sufficient

  • Thank you always @R_J‌ I did .SearchResults img {display: none}
    It seems I solved my problem.

    However, on the other hand, I'm trying to understand what hgtonight said. lol.

  • You have a bootstrap.before and a bootstrap.after file which are executed during each pageload. In Vanilla there are a lot of functions that are defined in a way that you can override them. "Simply" create a function with the same name in the bootstrap.after file, and you can change the way Vanilla displays the search results. The condense function normally works like that: https://github.com/vanilla/vanilla/blob/2.1/library/core/functions.render.php#L209-215

  • hgtonighthgtonight MVP
    edited September 2014

    Place the following in a plugin:

    public function SearchController_BeforeItemContent_Handler($Sender) {
      $Summary =& $Sender->EventArguments['Row']->Summary;
      $Summary = preg_replace('/<img[^>]*>/xi', '', $Summary);
    }
    

    Not sure how to get started with plugins in Vanilla? http://vanillawiki.homebrewforums.net/index.php/Hello_World_Plugin

    EDIT - @R_J covered it.

  • boardwalkboardwalk New
    edited September 2014

    Thank you for all the replies. Now I have time to try your answers. I will try it!

    By the way, it was not easy to study Vanilla Forum framework.

    But now, I think I can start with the Vanilla forum wiki. Thank you for the link.

    I want to build my own theme :-)

    PS. I am looking at this site markosullivan.ca/garden-preview-part-iii-anatomy-of-a-request/

    but none of pictures are viewable.... Is there alternative site for these subjects?

    (Oh... He is the creator of Vanilla!)

  • The official Vanilla docs are here: http://docs.vanillaforums.com/ and I guess that you can find most of marks blog posts there, too (somewhat enhanced, I'd guess)

  • Alright! Thanks :)

    I'm reading it now.

Sign In or Register to comment.