Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
make your only one section search.
Hi all,
i’ve made some modification to the publish.php file to be able to search in only one section (ofcourse it should be Included in site search ) and i use a little trick by passing new attribute in search form (ss = section search ) and make the publish check if the section name = the value of ss ..
so the modification in publish.php is :
line 214 convert to : $out = makeOut(‘id’,‘s’,‘c’,‘q’,‘pg’,‘p’,‘ss’,‘month’,‘author’);
put after line 513:
514: $theAtts[‘ssearch’] = ($ss)? $ss : ‘’;
after line 550:
551 : $ssearch = ($ssearch and !$section) ? “ and Section = ‘”.doslash($ssearch).”’” : ‘’;
then convert line 596
to be :
<p>
that is all for this file .. then you need to use custom form for now ( i will try to add ss attribute to search_input )
like this : </p>
form action=”<txp:site_url />search” method=“get”
input type=“text” name=“q” value=“search…” size=“20” /
input type=“hidden” name=“ss” value=”<txp:section />” size=“20” /
/form
<p>
as you see just add a hidden field with the name ss and the value of the section name (that is where you should add your section search form or just type it like value=“sectionname” if you want it static. </p>
hope it works fine with you all . and sorry for my poor english .
see you ..
ps: i couldn’t send the post using the html tags so i did it . i hope the moderator can fix it , please
Offline
#2 2006-08-19 21:39:46
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: make your only one section search.
You can do this without hacking: FAQ
Offline
Re: make your only one section search.
Mary , believe me i tried this many times and it make nothing .. it wasn’t working with me so i decide to make the modification .. i use Textpattern version: 4.0.3 (r1188) and as mentioned here : http://textpattern.org/tips/427/restricting-search-to-one-section there is a version limit to revision 342 or greater.
i don’t know why it didn’t work with me but that is what i did to solve it ..
thanks .
Offline
#4 2006-08-19 22:50:12
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: make your only one section search.
That entry’s warning at txp.org is outdated (4.0.3 is far, far greater than revision 342). The FAQ applies and it does work (or, it is supposed to). If you have problems with it, then you should ask for help. :)
Offline
Pages: 1