News:

Want to get involved in developing SMF? Why not lend a hand on our GitHub!

Main Menu

search limited to one topic

Started by k2s, May 05, 2005, 03:52:47 AM

Previous topic - Next topic

k2s

Some topic have >20 pages of replies. It would be great to have the possibility to do quick search inside this posts.

klumy



NoRad

There you go. Add a link on the template for the topic display that says "Search this topic" and auto-populate it with the topic=topic.id or whatever the variable is. Sweet.

k2s

Perfect, but it does not work in 1.0.3.
Am I right ?

NoRad


NoRad

Ok, I take that back. It works on the SMF forum, but it doesn't work on my forum?

I edited display.template.php to look like this:

Search for ...
$buttonArray[] = '<a href="' . $scripturl . '?action=printpage;topic=' . $context['current_topic'] . '.0" target="_blank">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/print.gif" alt="' . $txt[465] . '" border="0" />' : $txt[465]) . '</a>';


add this under that line of code:
$buttonArray[] = '<a href="' . $scripturl . '?action=search;topic=' . $context['current_topic'] . '.0">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/search.gif" alt="' . $txt[182] . '"  border="0" />' : $txt[182]) . '</a>';

My search button seems to be a tad smaller than the others here, but it's close enough for now. Unfortunately, this doesn't produce the same results as the link unknown posted above?

Ben_S

You could always upgrade to 1.1 beta 1 since you are a charter member...
Liverpool FC Forum with 14 million+ posts.

NoRad


k2s

But I am not :-(. I have to wait.

Ben_S

Liverpool FC Forum with 14 million+ posts.

NoRad

Yeah, and it just hosed my site.  :-[

Ben_S

Liverpool FC Forum with 14 million+ posts.

NoRad

Of course.

For those reading, don't get the wrong idea. 1.1 was pretty slick. My problem was #1 I had old outdated templates and #2 I am using a mambo bridge that did not support the new changes. No worries for the average user.

klumy

Quote from: Radianation on May 05, 2005, 02:44:38 PM
There you go. Add a link on the template for the topic display that says "Search this topic" and auto-populate it with the topic=topic.id or whatever the variable is. Sweet.

is it also possible to just display a searchfield instead of a link. A search field would be much more comfortable and faster for the user, because you needn't to load a second site

NoRad

Yes of course. Just check the search page to see how it passes the searched information and emulate that, replacing the button in my code above with your search box and just make sure you include the topic=

Advertisement: