Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2014-09-30 05:50:18

alivato
Member
Registered: 2011-03-31
Posts: 151

Search_results replay articles

The site consists of ~ 100 articles.
3 articles site contain the word “tin”. If you search for, then these articles are displayed 3 times?

for example

Article 30
Article 57
Article 60

Article 30
Article 57
Article 60

Article 30
Article 57
Article 60

How to make sure that articles are not repeated?

Offline

#2 2014-09-30 08:14:14

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,270
Website GitHub

Re: Search_results replay articles

alivato wrote #284324:

How to make sure that articles are not repeated?

Ensure you only have one <txp:article /> (or <txp:article_custom />) tag in your page flow. If your page encounters more than one it will repeat the results for every article tag it finds.

The best way to do this is to make sure your search results are self-contained on your page by wrapping one article tag in a <txp:if_search> conditional and putting the remaining page logic in the <txp:else /> branch.

If you’ve already done that, please post any relevant Page template code and we’ll go from there. Hope that helps.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#3 2014-10-04 21:28:12

alivato
Member
Registered: 2011-03-31
Posts: 151

Re: Search_results replay articles

Form search_results

<txp:if_search>
  <txp:article limit="99" pgonly="1" />
  <txp:if_search_results>
    <p>search results: <txp:search_result_count /></p>
    <txp:article limit="99">
<h3 class="entry-title"><txp:permlink><txp:title /></txp:permlink></h3>
<p class="published"><txp:posted /></p>
<p class="entry-summary"><txp:search_result_excerpt /></p>
<p class="small"><txp:permlink><txp:permlink /></txp:permlink></p>
<div class="divider"><txp:image id="1" /></div>
</txp:article>
  <txp:else />
    <p>nothing found <strong><txp:search_term /></strong>.</p>
  </txp:if_search_results>
<txp:else />
 <txp:if_section name=" ,uudised">
	<txp:article status="sticky" />
	<txp:article limit="3" />
	<txp:newer />
	<txp:older />
 </txp:if_section>
</txp:if_search>

?

Last edited by alivato (2014-10-05 08:16:47)

Offline

Board footer

Powered by FluxBB