Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2006-03-02 07:52:01
- Luxebot
- Member
- From: Los Angeles
- Registered: 2006-02-18
- Posts: 25
Searching and Sticky Articles
Hi there,
I have stickies in every section of my page. However, they are not searchable.
This is what I have in my page code:
<code>
<div id=“content”>
<txp:if_search>
<txp:else />
<txp:article status=“sticky” limit=1 searchsticky=1 />
</txp:if_search>
<txp:article limit=3 />
<txp:if_article_list>
<p>
<txp:older>Older</txp:older>
<txp:newer>Newer</txp:newer>
</p>
</txp:if_article_list>
<txp:if_search>
<txp:php>
global $thispage; global $q;
echo( ($thispage[‘total’]==0 ?
“Sorry, no match found for your request.” :
“Your search for <strong>$q</strong> resulted in “.$thispage[‘total’].” hits.” ) );
</txp:php>
<txp:else />
</txp:if_search>
</div>
</code>
Is there something I’m doing wrong? I have used this solution at http://forum.textpattern.com/viewtopic.php?pid=92471#p92471 and also I’m using wet’s “No search results found” solution here: http://forum.textpattern.com/viewtopic.php?id=14040 — are the two incompatible?
Non-sticky articles show up ok in the results.
Thanks for any help!
Offline
#2 2006-03-02 07:55:05
- Luxebot
- Member
- From: Los Angeles
- Registered: 2006-02-18
- Posts: 25
Re: Searching and Sticky Articles
Um, I found the solution. Instead of putting <code>txp:article status=“sticky” limit=1 searchsticky=1 /></code>, you have to put the searchsticky=1 in the regular article tag, like <code><txp:article limit=3 searchsticky=1 /></code>.
In case anyone was having the same issue as me.
Offline
Re: Searching and Sticky Articles
Just been fiddling with this too. Note that for the number of hits to register correctly you also need to put searchsticky into the initial iteration of <code>txp:article</code> with <code>pgonly=1</code> or else it will say 7 entries found and then proceed to list 9 entries if two of them are sticky articles :-)
BTW: As posted above, something looks like it’s in the wrong order in your posted code.
I have it set up like this in my page template:
<code><txp:if_search>
<txp:output_form form=“search_form” />
<txp:else />
<txp:article limit=“1” />
</txp:if_search></code>
with “search_form” like this:
<code>
<h2>Search Results</h2>
<txp:article pgonly=1 searchsticky=1 />
<p><txp:php>
global $thispage; global $q;
echo( ($thispage[‘total’]==0 ?
“Sorry, no match found for your search. If you have searched for several terms, try searching for individual words.” :
“Your search for <strong>$q</strong> “.
“returned “.$thispage[‘total’].” entries:”) );
</txp:php></p>
<txp:article searchsticky=1 /></code>
TXP Builders – finely-crafted code, design and txp
Offline
Pages: 1