vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Split thread title into searchable keyword components (https://vborg.vbsupport.ru/showthread.php?t=72482)

Dean C 12-03-2004 10:00 PM

Split thread title into searchable keyword components
 
[Split thread title into searchable keyword components]

Information
  • [high]vBulletin Version:[/high] 3.0.x

  • [high]Author:[/high] Dean Clatworthy

  • [high]Copyright:[/high] You may use this modification at your own risk. I cannot and will not be held responsible for any damage you may cause to your forums during installation or thereafter. You may not distribute this modification in whole or parts and anyone found doing so faces risk of prosecution. All my modifications are released at vBulletin.org and anyone found releasing them elsewhere also faces risk of prosecution. You may not translate this modification without my prior permission.

  • [high]Donations:[/high] I release my modifications for free. If you wish to donate please contact me and I will give you my details. All donations are graciously appreciated.

What does this modification do?
[size=1]This modification will allow you to split your thread title into the navbar into searchable components. You have three searchable options at the moment but it can easily be modified. These searchable sites are:
  • Your forums search engine (default)
  • Dictionary.com
  • Google

Installation

1/

In showthread.php find:

PHP Code:

$navbits[''] = $thread['title']; 

ABOVE it place:
PHP Code:

// #############################################################################
// START: split thread title into keyword search components
$sites = array(
    
=> '<a href="' $vboptions['bburl'] . '/search.php?q=%1s">%2s</a>',
    
=> '<a href="http://www.google.com/search?q=%1s">%2s</a>',
    
=> '<a href="http://dictionary.reference.com/search?q=%1s">%2s</a>',
);

// selete the number from above of the site you want to search
$chooseoption 1;

// get rid of all stupid characters (sacrifice so we don't break the query string
$ttitle preg_replace("/[^a-z0-9\-_\'\s]/i"''$thread['title']);

// split thread title by any number of commas or space characters
$ttitle preg_split("/[\s,]+/"$ttitle);

// loop through all words replacing the delimeter with the word
if(is_array($ttitle))
{
    foreach(
$ttitle AS $tword)
    {
        
$twords[] = sprintf($sites["$chooseoption"], $tword$tword);
    }

    
// get back into a readable title
    
$thread['title'] = implode(' '$twords);
}
// END: split thread title into keyword search components
// ############################################################################# 

Please Click Install!
If you installed this modifcation please click the install button. It'll help you keep up to date with future releases and important bugfixes, security updates.

Dean C 12-04-2004 12:54 PM

Custom Searches

This modification offers a great flexibility in that you can make other searches. Unfortunately you can only choose one at a time but this post will contain a list of some of the other search options you can choose.

How to make/add a search

You can only use TWO arguements when writing your search addon. These are BOTH the word in question. These are referenced by placing %1s and %2s within your search string. It'll replace these with the word.

What you need to do is find the last search. by default it will be
PHP Code:

    3 => '<a href="http://dictionary.reference.com/search?q=%1s">%2s</a>'

Then below it place the custom search. Be sure to place the X with the next number down.

List of custom searches

Urban Dictionary
PHP Code:

    X => '<a href="http://www.urbandictionary.com/define.php?term=%1s">%2s</a>'

Yahoo Search
PHP Code:

    X => '<a href="http://search.yahoo.com/search?p=%1s">%2s</a>'


vBTotal 12-04-2004 01:20 PM

cool, thanks :)

Lethal 12-04-2004 01:48 PM

nice ;)

NightWalk8r 12-04-2004 04:12 PM

very cool.....thanks =D

glenvw 12-04-2004 04:46 PM

Cool!

This will really help me find posts in a hurry.

Lionel 12-04-2004 06:02 PM

That does not work with foreign languages with accent. For example the character " ï " is not recognized, therefore is skipped. Haïfa becomes Hafa in the thread title.

it also skips characters such as "(" etc... basically distorting the title

Dean C 12-04-2004 07:05 PM

I deliberately did this. Foreign characters are not recognized by vB3's search (when using the query string), and also not by most sites which allow input from the query string. The same with other characters like brackets :)

okc 12-04-2004 07:58 PM

Dean - thx so much for working on this - I changed the text in my showthread.php then replaced the old file with the new - I don't see a change on my boards - did I do s/thing wrong?

Cheers

Dean C 12-04-2004 08:36 PM

Quote:

Originally Posted by okc
Dean - thx so much for working on this - I changed the text in my showthread.php then replaced the old file with the new - I don't see a change on my boards - did I do s/thing wrong?

Cheers

I don't know is the honest answer. Are you using vB3.0.3? Make sure you added the code in the right place? I just applied this modification to my second test board and it works there too so it must be something your end :)

okc 12-04-2004 10:17 PM

I have vb3.03

Do I I ftp the file to my desktop, open in wordpad, then add the changes & then ftp the file back to my forums folder, or do I have to go into myphp admin?

Also, do I include th etext in orange or not?

Thx guys

???`S?LV?R???` 12-04-2004 10:27 PM

sounds like a nice hack, might have some use for this

okc 12-04-2004 10:53 PM

Could anyone giveme some guidance as to why this isn't working - or what should I see on my threads - I don't notice anything different. How does it manifest itself on the bboard?

Thx

okc 12-04-2004 11:44 PM

Forget it - it's working - thx!

okc 12-04-2004 11:57 PM

One more question - does anyone know how to add a small bit of text next to the searchable thread title that would let users know about this feature so they don't miss it? - like "<-- click on word to search"

Torqued 12-05-2004 03:27 AM

What would it take so that you could get a dropdown on each word with different search options for each word? :) It would be kinda neat to be able to search on the board *or* on Google

*clicks install*

Dean C 12-05-2004 10:29 AM

Tell me where you want the "<-- click on word to search" to go and I'll modify the code for you to go in that position :)

okc 12-05-2004 04:56 PM

Thx! Right next to the search string ie

Beatles without Yoko <-- search on keyword

- ideally only where the search string shows up (not in the other places you see the navbar) & in smaller font

Dean C 12-05-2004 04:59 PM

Ok open up showthread.php and find:

PHP Code:

$thread['title'] = implode(' '$twords); 

Replace it with:
PHP Code:

$thread['title'] = implode(' '$twords) . '<span class="smallfont"><-- search on keyword</span>'


okc 12-05-2004 05:27 PM

Excellent - thx - 2 ?'s
1- Can the text be a tiny bit smaller that says search here?
2- Can I paypal you a little s/thing for your efforts? cheers

Dean C 12-05-2004 05:33 PM

1/ Try this

Find:
PHP Code:

 $thread['title'] = implode(' '$twords) . '<span class="smallfont"><-- search on keyword</span>'

Replace with:

PHP Code:

 $thread['title'] = implode(' '$twords) . '<span style="font-size: 9px; font-family: font-family: Verdana, Arial, Helvetica, sans-serif;"><-- search on keyword</span>'

2/ Sure send me a PM and i'll give you my info :)

owner 12-05-2004 06:34 PM

This works nice :) ... but gotta understand how 2 use the google and yahoo in it. Awsome using this last post as well. Btw does it affect the site on google search ranks bec of this ? ... POssible to Put google search adsense into this? .... Thankyou

Dean C 12-05-2004 07:13 PM

Sorry owner, I didn't quite understand what you were saying in your last post :(

owner 12-07-2004 10:09 AM

Ok hmmm u must be knowing of www.google.com/adsense i have an account over there and iam placing their ads. Now they also have a feature of google search 2 be placed on the site. I wanted 2 know if that code is possible 2 be placed into this ? ... hmm i guess ill post the code .. here it is
Quote:

<!-- Search Google -->
<center>
<form method="get" action="http://www.google.com/custom" target="_top">
<table>
<input type="text" name="q" size="31" maxlength="255" value=""></input>
<input type="submit" name="sa" value="Search"></input>
<input type="hidden" name="client" value="pub-23232323(Each user has its own id code, so i guess this will be changed depending on the user,so u might wanna add this in ure description)"></input>
<input type="hidden" name="forid" value="1"></input>
<input type="hidden" name="ie" value="ISO-8859-1"></input>
<input type="hidden" name="oe" value="ISO-8859-1"></input>
<input type="hidden" name="cof" value="GALT:#008000;GL:1;DIV:#336699;VLC:663399;AH :center;BGC:FFFFFF;LBGC:336699;ALC:0000FF;LC:0000F F;T:000000;GFNT:0000FF;GIMP:0000FF;FORID:1;"></input>
<input type="hidden" name="hl" value="en"></input>
</table>
</form>
</center>
<!-- Search Google -->

Dean C 12-07-2004 05:28 PM

It's possible as I think you can spoof the headers as if you were posting a form with a redirection script, however I don't know if google allows you to do this? Might want to ask them?

owner 12-07-2004 07:05 PM

Hmmm true, i should ask them... but how about making up the code and presenting it 2 google and asking them if its ok 2 run it. cause they have spiders and they can catch on anything they dont like :D ... so ill ask them regarding the code you make and then publish it ? .. that k ?

Torqued 12-07-2004 07:45 PM

Quote:

Originally Posted by Torqued
What would it take so that you could get a dropdown on each word with different search options for each word? :) It would be kinda neat to be able to search on the board *or* on Google

Dean, any comments on this idea? :)

owner 12-07-2004 08:05 PM

Quote:

Originally Posted by Torqued
Dean, any comments on this idea? :)

-- I would personally love this idea ... Its nice ..

morrow 12-09-2004 02:12 PM

Welp, looks like it could be a nice hack. I've installed it but have no idea what I just installed. hahahaha... :) Is there something visual here, or is it just behind the scenes stuff like:

google search... site http://www.njflyfishing.com "trout"

something like that?

morrow 12-09-2004 02:20 PM

Ok, scratch that last question. I figured it out. What I would like to know is this. When you click on a search word, how does google or yahoo or whatever, get factored into the search. When I click on a word, the only things returned are items that are right from my site.

Dean C 12-09-2004 05:51 PM

You have to change the option within the actual code you added. Be careful though. I'll assume you have no knowledge of PHP so just look for a list kinda thing. It'll be numbered from 1-3 by default. Then below that is a variable. If you want it to search google you select the number that google is in the list:


PHP Code:

// selete the number from above of the site you want to search
$chooseoption 1


morrow 12-09-2004 06:12 PM

Quote:

Originally Posted by Dean C
You have to change the option within the actual code you added. Be careful though. I'll assume you have no knowledge of PHP so just look for a list kinda thing. It'll be numbered from 1-3 by default. Then below that is a variable. If you want it to search google you select the number that google is in the list:


PHP Code:

// selete the number from above of the site you want to search
$chooseoption 1


Ok, So basically we can have as many search engines in the code as we want but only 1 will be used for the actual search.

Is there a way to make this a dropdown menu... so if I hover my mouse over any of the search words, I will get a list of utils such as, (Search site / Search Google / Yahooo.....)...

then of course when you click on it, it will search the cooresponding search engine or site? If not, that's ok, it's still a nice hack.

Thanks again.

Dean C 12-12-2004 11:23 AM

I thought about adding a dropdown but I think it'll look really tacky.

Torqued 02-07-2005 11:38 PM

Is there a way to fix it so that the <title> in the <head> tags doesn't look like this and muck up the title in the title bar of the browser?:

Quote:

<title>www.informaticsnurse.com - <a href="http://www.informaticsnurse.com/forums/search.php?q=Program">Program</a> <a href="http://www.informaticsnurse.com/forums/search.php?q=Manager">Manager</a> <a href="http://www.informaticsnurse.com/forums/search.php?q=Outcomes">Outcomes</a> <a href="http://www.informaticsnurse.com/forums/search.php?q=Measurement">Measurement</a> <a href="http://www.informaticsnurse.com/forums/search.php?q=ampamp">ampamp</a> <a href="http://www.informaticsnurse.com/forums/search.php?q=Reporting">Reporting</a></title>

MikaK 02-26-2005 04:23 PM

So Installed. Addmittedly took also me a while to get the "what changed here?". For anyone still figuring it out: The thread tiltle words become clickable in the navbar breadcrumb where typically the viewed thread title is black. After installing this hack the title of the viewed thread turns each word of the title into a clickable search link.

Regs,
-Mika *feeling like the master of the obvious*

T3MEDIA 03-20-2005 12:50 PM

LOL thanks I was like... ok what does this do.
After being on vb for a while you learn not to install anything... even if its your test board.

MikaK 12-11-2005 05:31 PM

Quote:

Originally Posted by Torqued
Is there a way to fix it so that the <title> in the <head> tags doesn't look like this and muck up the title in the title bar of the browser?:

Still on 303. Can this be fixed?

-M


All times are GMT. The time now is 03:53 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01510 seconds
  • Memory Usage 1,843KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (11)bbcode_php_printable
  • (7)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (37)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete