Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#61 2005-09-12 10:09:48

squaredeye
Member
From: Greenville, SC
Registered: 2005-07-31
Posts: 1,495
Website

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


Offline

#62 2005-09-12 10:42:37

gerhard
Plugin Author
From: London, UK
Registered: 2005-06-29
Posts: 409
Website

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

#64 2005-09-18 14:29:34

spiros
Member
From: Athens
Registered: 2005-07-01
Posts: 29
Website

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

#65 2005-09-19 08:52:34

gerhard
Plugin Author
From: London, UK
Registered: 2005-06-29
Posts: 409
Website

Re: [plugin] [ORPHAN] rss_live_search

spiros, it does. The query word appears in bold within the search results.

Offline

#66 2005-09-19 09:07:15

spiros
Member
From: Athens
Registered: 2005-07-01
Posts: 29
Website

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

#67 2005-09-19 10:18:11

gerhard
Plugin Author
From: London, UK
Registered: 2005-06-29
Posts: 409
Website

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

#68 2005-09-19 12:45:44

spiros
Member
From: Athens
Registered: 2005-07-01
Posts: 29
Website

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

#69 2005-09-19 13:18:29

gerhard
Plugin Author
From: London, UK
Registered: 2005-06-29
Posts: 409
Website

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 &lt; strong class="just_bold" &gt; ....

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

#70 2005-09-19 15:34:15

spiros
Member
From: Athens
Registered: 2005-07-01
Posts: 29
Website

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

#71 2005-09-19 18:18:11

gerhard
Plugin Author
From: London, UK
Registered: 2005-06-29
Posts: 409
Website

Re: [plugin] [ORPHAN] rss_live_search

Spiros, that plugin is heavy stuff – or I had 1 too many to drink : ))).

I would suggest getting in touch with Nikolaos. He might be of better help because this requires some insider knowledge ; ).

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

Board footer

Powered by FluxBB