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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

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

Custom Search Results Page


Go to End


871 Views

Avatar
JefersonPaz

Community Member, 3 Posts

16 July 2013 at 6:08am

Hello, I'm having some troubles generating a custom searh results page, my content is pretty much huge images, and all of them with alternative texts as tags for the search, but the results are spilled out as an huge list of really big images, all in one page. All I need is that I could set 3 full image results (full page content), and all the others was a text with a thumbnail aside (pretty much a list with thumbnails). Can anyone enlighten me?

the code:

<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push(['_setCustomVar',
1,
'Username',
'$CurrentMember.FirstName $CurrentMember.Surname',
2
]);
_gaq.push(['_setAccount', 'UA-38537736-1']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

</script>
<div id="buscaestilo">
<% if Results %>
<ul id="SearchResults">
<% control Results %>
<li>
<% if MenuTitle %>
<h3><a class="searchResultHeader" href="$Link">$MenuTitle</a></h3>
<% else %>
<h3><a class="searchResultHeader" href="$Link">$Title</a></h3>
<% end_if %>
<% if Content %>
$Content.FirstParagraph(html)
<% end_if %>
<br>

<div id="buscaestilo2"><a class="readMoreLink" href="$Link" title="Leia maid sobre &quot;{$Title}&quot;">Leia mais sobre &quot;{$Title}&quot;...</a></div>

</li>
<div class="clear"></div>
<div class="clear"></div><br><br>
<% end_control %>
</ul>
<div class="clear"></div>
<div class="clear"></div><br><br>
<% else %>

<p>
<%-- Example of a translatable string (see http://doc.silverstripe.org/i18n) --%>
<% _t("Page_results.ss.NORESULTS", "Sorry, your search query did not return any results.") %>
<%-- By the way, template comments marked like this will be excluded from the HTML output --%>
</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 %>
<span>
<% control Results.SummaryPagination(5) %>
<% if CurrentBool %>
$PageNum
<% else %>
<a href="$Link" title="View page number $PageNum">$PageNum</a>
<% end_if %>
<% end_control %>
</span>

<% end_if %>
</div>

Thanks in advice.