Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: [plugin] [ORPHAN] rss_live_search
Gerhard,
Well done! That did it exactly how I liked it. 2 questions:
1. I suppose if I want to then have a section that searches the whole site, I could use a the default search form, yeah? It would be a less than perfect scenario, but I think I could live with it?
2. per your instructions above: Will I now need to create a section called article that I treat as my home page? That part confunded me noggin.
Cheers dude,
Matthew
- I am Squared Eye and I
am launchinghave launched Pattern Tap
Offline
Re: [plugin] [ORPHAN] rss_live_search
Hmmm… I have an idea. If you are on the home page, it makes sense for the live search to look in all articles on the site.
Starting from the original rss_live_search (undo the mods that I initially suggested) and do the following:
A. after <pre>if (gps(‘ls’) != “”) { function livesearch( $q, $max, $doExc, $notfound, $showdate, $form) {</pre> add <code> $section = $GLOBALS[‘s’];</code>
B. Replace <pre>$where = “(Title rlike ‘$q’ or Body rlike ‘$q’) $s_filter and Status = 4 and Posted <=now() order by score desc limit $max”;</pre> with <code>$where = ($section == “default”) ? “(Title rlike ‘$q’ or Body rlike ‘$q’) $s_filter and Status = 4 and Posted <=now() order by score desc limit $max” : “(Title rlike ‘$q’ or Body rlike ‘$q’) $s_filter and section=’$section’ and Status = 4 and Posted <=now() order by score desc limit $max”;</code>
C. Enjoy ; ).
As a suggestion for other folks as well, if you want rss_live_search to look in other fields apart from Title and Body take as example the query that I use to search in Title, Body, Category1, Category2 and custom_1:
<code>$where = “(Title rlike ‘$q’ or Body rlike ‘$q’ or Category1 rlike ‘$q’ or Category2 rlike ‘$q’ or custom_1 rlike ‘$q’) $s_filter and Status = 4 and Posted <=now() order by score desc limit $max”;</code>
When on the home page, if u still want to look only for articles belonigng to article section, then go with my initial mods and just make sure article section is set to appear on home page (unselect the option for other sections to be shown on home page). From now on, only articles assigned to article section will be shown on the front page. Obviously, you can call this section whatever you want (news? blog? it’s up to you). ; )
Offline
#63 2005-09-17 17:25:22
- els
- Moderator

- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: [plugin] [ORPHAN] rss_live_search
I just noticed a change in the plugin behaviour, and I’m not sure when it started. It could have been after I upgraded to 4.0.1., or when I started using gbp_faux_static. Must be one of those two I think.
Whatever is entered in the search box, TXP’s 404 error page is shown where the search results should be. But when I press ‘enter’ it goes to my regular search results page.
EDIT: O.k., sorry for this. This only happens on an article page, and I changed those urls with gbp_faux_static. So now I know the reason. Not the solution though… or if it even is possible to use rss_live_search with those urls of mine (/category/title).
Last edited by doggiez (2005-09-17 17:31:10)
Offline
Re: [plugin] [ORPHAN] rss_live_search
It would be quite helpful if it produced some kind of highlighting on the search results page with the word searched…
Offline
Offline
Re: [plugin] [ORPHAN] rss_live_search
Hi Gerhard,
You are right; I was not quite specific. I mean when one uses the arrow keys and enter. In this case the search term is not bold.
Offline
Re: [plugin] [ORPHAN] rss_live_search
Hmm, I wonder why you would want to use the keys. I never use them and don’t really see the point in them. Besides, the key support doesn’t seem to be working the way it should under Safari 2.0…
If you are referring to the landing pages (when you get to the search result you want, hit enter and land on the content page itself), then that would be beyond the scope of this plugin and some hacking would be required to the article() function that handles the way articles are outputted. If you want to get your feet wet, be my guest. I am trying to get to grips with article() myself and it’s not easy…
Last edited by gerhard (2005-09-19 10:19:09)
Offline
Re: [plugin] [ORPHAN] rss_live_search
Hi Gerhard,
Indeed, you are correct; I mean the landing pages. Alas, my php knowledge is fairly basic to tackle such a task!
On the other hand, instead of bold letters in the standard search, wouldn’t it be possible to have a highlighting effect? I tried to find some sort of css which controls this but apparently there isn’t….
Last edited by spiros (2005-09-19 12:47:35)
Offline
Re: [plugin] [ORPHAN] rss_live_search
Spiros, just style the default strong tag. Make sure you have another class for strong to use on pages where you want text to appear just bold (e.g. strong.just_bold { font-weight: 700; } and then < strong class="just_bold" > ....
What you are looking for is a hack to article(). I don’t think it will be a 5’ jobbie and, to be honest, I don’t think it’s worth the hassle. If you want it that bad, dive into PHP ; ).
Last edited by gerhard (2005-09-19 13:18:47)
Offline
Re: [plugin] [ORPHAN] rss_live_search
OK thanks Gerhard! I think I found a plug-in which does that
http://textpattern.org/plugins/391/etzhilite
but applies only to non UTF blogs.
Offline
Offline
#72 2005-09-23 02:58:06
- SuperStar
- New Member
- From: New Zealand
- Registered: 2005-09-23
- Posts: 7
Re: [plugin] [ORPHAN] rss_live_search
Adding a “section” parameter to the tag to specify the section you wish to search. Could this added to the next version?
I have modified my copy of version 0.2.2 and it works quite well. It certainly helps when you want different searches to be specific!
Cheers,
Nick.
Offline
Re: [plugin] [ORPHAN] rss_live_search
Very nice plugin thank you. Question – how to style the results list? I can’t view source to see what is coming up so I am not sure of what’s there. I used the styles that are specified in the plugin help, and can style those without problem.
It would be nice to have a hover effect rather like Rob has on his site at wilshireone.com.
Also, I find that the arrows up and down don’t work. Or rather, it did yesterday and now it doesn’t!
I have this for the code:
<code><div id=“live_search”>
<txp:rss_live_search label=“Live Søk:” inputsize=“10” form=“live_search_results” notfound=“Ingen resultater!” />
</div></code>
In my form I have:
<code><txp:permlink><txp:title /></txp:permlink><br />
<txp:posted /></code>
Probably missed something basic here!
Offline
Re: [plugin] [ORPHAN] rss_live_search
For styling, try this for starters.
There are lots of other ways to do it, but this is some help I got from john hicks
/* LiveSearch */
/* ———————————————————————————- */
#livesearch {
width:320px;
font-size: 10px;
}
#LSResult {
position: absolute;
background: url(/images/con_bkgd.png);
width:320px;
overflow: hidden;
z-index:100;
border: 1px solid #ddd;
}
#LSResult a {
color: #333;
display: block;
padding: 2px 5px;
border-bottom: 0;
text-decoration: none;
}
ins {
border-bottom: 0;
text-decoration: none;
}
#LSResult a:hover {
background-color: #999;
color: #fff;
}
#LSResult ul,
#LSResult li {
list-style-type:none;
list-style-image: none;
margin: 0;
padding: 0;
}
———————————————————————
Per your arrows question, I don’t think that functionailty should change unless you have done some editing to any php in your plugin or in the installation at large.
Cheers,
Matthew
- I am Squared Eye and I
am launchinghave launched Pattern Tap
Offline
Re: [plugin] [ORPHAN] rss_live_search
Thanks for the help Mathew. The style I was missing was LSResult a and LSResult a:hover since it was not part of the examples given by Rob, and I find it impossible to view source when the live search is on. Its a nice plugin.
Can’t get the arrows to work even with a simple call to the plugin. Worked yesterday. Mystery!
Offline