Tag and Search for PDF Files on Website

Hello,

I am designing a website for the Daily Bull, our college’s comedy daily newspaper. At first we had planned to just place each day’s PDF in a directory of which users could access by date.

I proposed that we create a search field on our homepage that people could search for issues by Writers of that day, Article Names, of course Date, and other tags.

I am completely new to PHP and only have experience with Webpage design in HTML and CSS.

Could someone please point me in the right direction to help me set up:

[b]> A way to tag PDF files, whether it be placing tags on the actual files, or creating a text document which contains a list of the files and their locations and tags for each.

A search bar which will search said text document or the PDFs themselves and return a page with links to the found files that match certain tags.[/b]

If it is more simple than I realize, I would appreciate a tutorial or quick example. If it is more complex than I hoped I can ether be shoved aside (as I don’t intend to get a degree to make this site) or at least show me in the right direction as to where to start looking.

Extra Thanks to any help given,

Daily Bull Writing Staff and their enslaved Webmaster (me) :smiley:

Rather than going from zero PHP to having a collection of e-books and a search engine, I would recommend using a Google Custom Search (http://www.google.co.uk/sitesearch/).

If you do actually want to use PHP, I would do the following:

[ul][li]Create a database listing the PDF files: (writers, articles, etc, tags).[/li]
[li]Write a search engine that looks through the database.[/li][/ul]

The ideal solution would have fields that are related to each other. Sample database structure:

newspapers

[ul][li]id[/li]
[li]course_date[/li][/ul]

newspaper_writers

[ul][li]id[/li]
[li]newspaper_id[/li]
[li]writer_name[/li][/ul]

newspaper_article

[ul][li]id[/li]
[li]newspaper_id[/li]
[li]article_name[/li][/ul]

Database Tutorial: http://www.w3schools.com/php/php_mysql_intro.asp

As you see, the structure for a database would be complicated. You could alternatively use files. Sample file:

a:4:{s:5:"title";s:10:"Some Paper";s:11:"date_issued";s:10:"12-34-5678";s:8:"articles";a:3:{i:0;s:10:"Some Title";i:1;s:13:"Another Title";i:2;s:14:"Sports is Kewl";}s:4:"tags";a:3:{i:0;s:14:"sports edition";i:1;s:13:"i like sports";i:2;s:7:"college";}}

Generated by:

[php]$newspaper = array(
‘title’ => ‘Some Paper’,
‘date_issued’ => ‘12-34-5678’,
‘articles’ => array(
‘Some Title’,
‘Another Title’,
‘Sports is Kewl’
),
‘tags’ => array(
‘sports edition’,
‘i like sports’,
‘college’
)
);

echo(serialize($newspaper));[/php]

About Serialize: http://terriswallow.com/weblog/2008/php-serialize-unserialize-whats-it-do-whats-it-for/
Serialize Function: http://php.net/manual/en/function.serialize.php
UnSerialize (Reverse) Function: http://php.net/manual/en/function.unserialize.php

In my opinion, save yourself the hard work and let Google do it.

Otherwise, get back to me with what route you want to take (database or file) and I’ll mock up an example search engine for you to learn from. :slight_smile:

Sponsor our Newsletter | Privacy Policy | Terms of Service