Search Application Design

Many years ago I was the supervisor for a series of projects that developed advanced search capabilities on a database of about 60,000 documents (mostly text documents several pages long). We used ASP/Visual Basic on MS Access and Sql Server databases - both web-based and stand-alone. I would now like to do something similar with PHP and MYSQL (web-based). I have been playing a bit with it with some success, but before investing more resources in this, I just want to step back and rethink the design.

Then we used frames – four frames on an index.html page with a

  1. search form frame,
  2. an output to summary table frame,
  3. a full document text frame, and
  4. a frame with some menu options, etc.

The workflow was to do the search, click on a link in the results table (document number), and then the full document associated with the link would appear in the full text frame. Pretty efficient and clean – everything was visible on the same page, easy to change the search parameters and see the results, etc

But frames have been out of fashion for some time and I am wondering if there is a better way to achieve a similar result. Although I have been able to get some results with frames using PHP and MYSQL, it gets a little awkward posting the variables between pages, etc. Any suggestions on how to go about the design and planning would be greatly appreciated.

Then I can get down to working out the code and will need some help with that since I am new to both PHP and MYSQL. Thanks in advance for any help you can provide. - Dave

You are correct, frames are definitly seen as outdated and even though there probably are some rare use cases for them still this is not one of them.

You can easily include files in php, to “split up” the page, consider this:

[php]<?php

$page = filter_input(INPUT_GET, ‘page’, FILTER_SANITIZE_FULL_SPECIAL_CHARS);

if (empty($page)) {
$page = ‘front’;
}

switch ($page) {
case ‘front’:
case ‘document’:
include ‘/includes/header.php’;
include ‘/includes/menu.php’;
include ‘/pages/’.$page.’.php’;
include ‘/includes/footer.php’;
break;
default:
include ‘/includes/errors/404.php’;
exit;
break;
}[/php]

Here you will load the different page elements by themselves. You will ofcourse have to create the files in question

/includes/header.php /includes/menu.php /pages/front.php /pages/document.php /includes/footer.php /includes/errors/404.php

If you are building an application for production I’d definitly recommend using some kind of framework. There you will get built in caching (very important), routing, template engine, database handling, error handling, etc. Look into Symfony or Laravel, which are two popular PHP frameworks that are easy to get started with.

[hr]

You should also consider using javascript to dynamically load parts of a page without having to refresh. Example use:

[ul][li]user selects item in list of documents[/li]
[li]summary panel (div layer) automatically display some kind of summary data[/li]
[li]user clicks “read more”[/li]
[li]summary panel expands to full view and displays full text[/li][/ul]

Thanks so much. That’s exactly the kind of specific information I am looking for at this point in the process. I will be researching using php includes and javascript that are relevant to my goal. Although the application will probably not end up in production, I do want to go about it in a proper way, so will also be looking into the frameworks that you mentioned. It’s great to have so many, powerful options. Thanks again.

Sponsor our Newsletter | Privacy Policy | Terms of Service