View Full Version : Search/Browse Attachments Across All Forums
incursio
11-18-2001, 10:00 PM
A little something I whipped up for one of our busier sites, which has several thousand image attachments.
Basically, it allows you to perform searches for attachments across your forums, or just a single forum, by username. You can also sort by date posted, forum it was posted in, thread title, or the attachment filename.
This is a rewrite from the initial version. Due to popular demand, it now uses the vB template system. Yes, Virginia, including your headers and footers. It also uses attachment icons now - kind of a nice touch.
To install, copy attachment_browser.php to your main forums directory. Then, you'll need to create 3 templates:
attachment_browser_search_form
attachment_browser_results
attachment_browser_result_bits
A sample .SQL file is included with the distribution. To create the templates using this file, simply run it through the mysql client as follows:
/path/to/mysql -u user -ppassword db_name template < attachment_browser_templates.sql
Enjoy.
Cheers.
Scott
incursio
11-18-2001, 11:14 PM
Here's the file:
Cheers.
Scott
squawell
11-19-2001, 12:06 AM
any screenshot?? or something can make this hack clear~~
very useful hack thanks :)
incursio
11-19-2001, 02:02 AM
It isn't a hack - and no screenshots, you can see a vanilla example (no header, and a simple footer) here though:
http://www.wetcanvas.com/forums/browse_attach.php
Search for "scottb" for an example.
Cheers.
Scott
squawell
11-19-2001, 02:50 AM
oh~~~it's great !!
nice work !!
Admin
11-19-2001, 04:37 AM
I would use it but it's not template driven...
Is it supposed to be something external to the forum?
Originally posted by FireFly
I would use it but it's not template driven...
Is it supposed to be something external to the forum? It's pretty cool. I modified it to require config.php instead of having the database info in the file. But, I do need to get it to call the header and footer from my forums. Right now I'm using the includes from our home page.
incursio
11-19-2001, 05:20 AM
Getting it to use the headers/footers from the forums is a simple SELECT from the database. I'll post something tomorrow - going to bed now.
With regard to the look and feel of the actual results - you can simply customize the HTML in the script to do what you want.
Cheers.
Scott
Admin
11-19-2001, 05:52 AM
[QUOTE]Originally posted by incursio
With regard to the look and feel of the actual results - you can simply customize the HTML in the script to do what you want.
xware
11-19-2001, 08:58 AM
It's a good hack.
but I have found some wrong with it.
The searched attachments aren't as who had Attached in name and posts.
I have a better one and if someone need I'll release it.
incursio
11-19-2001, 01:27 PM
Originally posted by FireFly
http://vbulletin.com/forum/showthread.php?s=&threadid=33658
So have at it ...
incursio
11-19-2001, 01:28 PM
Originally posted by xware
The searched attachments aren't as who had Attached in name and posts.
Huh? Who said what who how?
incursio
11-19-2001, 03:22 PM
New version posted - see top of thread again.
Admin
11-19-2001, 03:27 PM
Two nice features that will be nice to have:
a) A drop down with all attachments types (gif jpeg zip etc) (only show those that were attached), and you can select which to show
b) Option to find all files that contain a string. Look for "bul" and it'll find "vbulletin.gif" and "bulls.zip".
incursio
11-19-2001, 03:28 PM
Will add those in this afternoon if I can. I'm leaving for the holiday tomorrow, so if I don't get to it, it will be a week or so.
Cheers.
Scott
incursio
11-19-2001, 07:44 PM
Well, I wrote the functionality for doing extension limiting and keyword searching, and its too slow. No matter how optimized I make the query or the approach, its just too damn slow - and my system only has about 5,000 attachments.
The problem is that there is no index on attachment.filename. You could make an index for it - even one of the newer fulltext indices, but the functionality isn't worth the size of the new index, IMHO.
Cheers.
Scott
Originally posted by incursio
New version posted - see top of thread again. I like this new version. :)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.