| Author |
Message |
Saszoo

Joined: 07 Jun 2006 Posts: 410 Location: Norway |
|
Some improvement to search.php wanted |
|
1. Ability to search in comments.
2. Display number of found results.
3. Not cache the highlighted text string, cause it's confusing when making a search #2 and finding same words highlighted instead of what you searched for.
4. FI-DD's wonderful hack to have search adresses such as domain.tld/search/searchword as standard.
5. A way to remove the codes from searchresult. Say one of the articles which contains the given searchword has a <img class="something" title="something" alt="something" src="img/img.jpg" />. If you're unfortunate the the extract form your news may start somewhere like ething" alt="something" src="img/img.jpg" /> This code will then be displayed instead of the image.
6. Searchcloud, maybe based on the search history hack?
7. Text if searchword recieves no hits.
_________________ My cute.ru site |
|
| Mon Jan 15, 2007 7:06 pm |
|
 |
Guest
|
|
|
Please login to hide the ads.
|
|
|
|
 |
scottdallas

Joined: 04 May 2006 Posts: 1943 Location: US |
|
|
|
Very nice feature list, I have to agree with all of it. I wish I could even get the highlight feature to work I take it out completely cause it always ruins my search results. I also wouldn't mind seeing the search form integrated into the admin panel so it could be edited like the templates. As far as I can see the actual search section in search.php is plain HTMl, so why not make it editable like the templates for n00bs to edit it easier (and lazy people like me).
_________________ www.scottdizzle.com uses cnr
last update: 07-22-08: 8:30 pm |
|
| Tue Jan 16, 2007 9:01 am |
|
 |
Saszoo

Joined: 07 Jun 2006 Posts: 410 Location: Norway |
|
|
|
Quick solution to #5.
I'm not yet a php-coder, but I think I make some progress, well based on the fact that I made a solution that I'm happy with.
To the solution:
Open search.php find
 |  | return $result; |
Add above:
 |  | $result = strip_tags($result); |
Wow, extreme isn't it? Nah, not really but it works.
Pros: Removes tag-fractions that might break your code, layout and what not, simple, also a way of removing images from search-result.
Cons: Removes all tags, not only the fraction-ones, meaning that there will be no working tags like <span> and <img> in your search-result.
_________________ My cute.ru site |
|
| Thu Jan 18, 2007 7:00 pm |
|
 |
FI-DD
Admin

Joined: 22 Sep 2005 Posts: 2801 Location: Germany |
|
|
|
 |  | Cons: Removes all tags, not only the fraction-ones, meaning that there will be no working tags like <span> and <img> in your search-result. |
Resource #1 for every php-coder: www.php.net
You will find the following example when searching for the strip_tags function:
 |  | // Allow <p>
echo strip_tags($text, '<p>'); |
So this should solve your problem:
 |  | $result = strip_tags($result, '<span><img>'); |
|
|
| Thu Jan 18, 2007 8:28 pm |
|
 |
Saszoo

Joined: 07 Jun 2006 Posts: 410 Location: Norway |
|
|
|
Ah, yes I know, and I've already tried it.
Only problem is that the bugger with tag-fraction still occurs. So if span or img is at the extraction-end you'll have code break which might mess up your layout.
And you're right. www.php.net is definatly a place I'll dig into. The manual is a great resource 
_________________ My cute.ru site |
|
| Thu Jan 18, 2007 10:44 pm |
|
 |
Torstein
Joined: 03 Aug 2006 Posts: 106
|
|
|
|
So i've been trying to get my search results to look somewhat nice, but I'm having some major problems with the search results looking like a mess.
So, is there some way to simply show the whole {short-story} instead of the area with highlights, etc.?
|
|
| Sat Mar 31, 2007 11:48 pm |
|
 |
FI-DD
Admin

Joined: 22 Sep 2005 Posts: 2801 Location: Germany |
|
|
|
In search.php change this:
 |  | add_filter('news-entry-content', 'Highlight_Search', 999); |
to this:
 |  | //add_filter('news-entry-content', 'Highlight_Search', 999); |
|
|
| Mon Apr 02, 2007 3:39 pm |
|
 |
|