Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Form Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Site Search Results Page - Some Issues...

Go to End

4 Posts   2940 Views


Community Member, 6 Posts

7 April 2009 at 9:03pm

Edited: 07/04/2009 9:03pm

I recently followed some of the examples to fine tune the search results page. I should mention that I am much more of a designer than a coder.

Firstly, I was wondering if anyone out there knows how to tweak the code, to add a style to every situation in the results of the word that has been searched for. For example when you search for a word in google, in the results that are returned the word is styled in bold. Another example is in these forum searches, where the words appear highlighted. - I think this would add a lot to the search facility.

I also have another problem where for some reason line breaks are being inserted into some of my resulting paragraphs, but not ones that come from my blog pages. - I can not figure out what is causing this.

Also, if images or flash elements are at the top of the pages returned, fragments of these elements are appearing in the search results, and it would be great if there was an easy way to omit them, but I'm not sure how.

The code I am using for the file is as follows:

<div class="typography">
	<% if Results %>
	    <ul id="SearchResults">
	      <% control Results %>
			  <% if Content %>
			  <% end_if %>
	          <a class="readMoreLink" href="$Link" title="Read more about "{$Title}"">Read more about "{$Title}"...</a>
	      <% end_control %>
	  <% else %>
	    <p>Sorry, your search query did not return any results.</p>
	  <% end_if %>

	  <% if Results.MoreThanOnePage %>
	    <div id="PageNumbers">
	      <% if Results.NotLastPage %>
	        <a class="next" href="$Results.NextLink" title="View the next page">Next</a>
	      <% end_if %>
	      <% if Results.NotFirstPage %>
	        <a class="prev" href="$Results.PrevLink" title="View the previous page">Prev</a>
	      <% end_if %>
	        <% control Results.SummaryPagination(5) %>
	          <% if CurrentBool %>
	          <% else %>
	            <a href="$Link" title="View page number $PageNum">$PageNum</a>
	          <% end_if %>
	        <% end_control %>
	 <% end_if %>

Anyway, if anyone can help or point me in the right direction it would be much appreciated.

Form & Code

Community Member, 7 Posts

3 October 2009 at 7:17pm

About your linebreak problem: You might want to add

#SearchResults p {

#SearchResults li br {

to your css. That display:none will get rid of the linebreak, though it looks a little ugly as no space is inserted.


Community Member, 6 Posts

3 October 2009 at 8:30pm

Hi odontodactylus,

Thanks heaps for the tip. - I'll check it out.



Community Member, 6 Posts

21 January 2010 at 4:44am

Thank you, that css tip worked for me, has gotten rid of huge gaps between lines - very glad to have finally fixed that as it was getting on my nerves somewhat!!!