Home arrow MySQL arrow Page 3 - Completing a Search Engine with MySQL and PHP 5

Defining a simple web page generating class - MySQL

Building database-driven web sites is one of the most popular trends today in web site development. However, this approach implies that potential visitors must be provided with a straightforward mechanism that allows them to search through web site content. This three-part series walks you through the process of building an expandable search engine by using the combined functionality of MySQL and PHP 5.

TABLE OF CONTENTS:
  1. Completing a Search Engine with MySQL and PHP 5
  2. Listing the full source code of the original search application
  3. Defining a simple web page generating class
  4. Developing a fully-functional practical example
By: Alejandro Gervasio
Rating: starstarstarstarstar / 12
August 13, 2007

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

As I stated in the prior section, the last task required to complete the development of this search application consists of building a simple yet effective web page generating class. This class will be responsible for creating the web documents required to display the results returned by a specified search query.

Of course, the definition of this brand new PHP class is entirely optional in this case, since the respective database results can be also shown by using a procedural approach instead of the object-oriented one that I'm explaining here. Nevertheless, I'd like to show you the signature for this class, regardless of the method that you may want to use for displaying the search results.

Given that, here's how this web page generating class looks:

<?php
class WebPage{
   private $title;
   public function __construct($title='MySQL-based Search
Engine'){
     $this->title=$title;
   }
   public function displayHeader(){
     return '<html><head><title>'.$this->title.'</title><link
href="default.css" rel="stylesheet" type="text/css" /></head>';
   }
   public function displayBody($content){
     return '<body>'.$content.'</body>';
   }
   public function displayFooter(){
     return '</html>';
   }
}
?>

Quite simple, right? As you can see, the signature for the above "WebPage" class doesn't bear too much discussion. It performs a few simple tasks, such as building the header, body and footer sections of a typical web document. Therefore, assuming that you won't have major problems understanding the way that this class works, it's time to move forward and develop a hands-on example, where you'll be able to see how this MySQL-driven search engine does its business.

To learn how this practical example will be created, please click on the link below and keep reading.



 
 
>>> More MySQL Articles          >>> More By Alejandro Gervasio
 

blog comments powered by Disqus
   

MYSQL ARTICLES

- Xeround Releases Free Version of MySQL Cloud...
- Oracle Announces New MySQL Specialization
- Constant Contact Chooses SkySQL for MySQL Su...
- Revoke Statement in MySQL
- The Grant Statement in MySQL
- SuccessBricks Announces ClearDB Availability...
- Building a PHP ORM: Deploying a Blog
- TROSYS Launches Free MySQL Manager and Admin...
- Building an ORM in PHP: Domain Modeling
- Building an ORM in PHP
- MySQL Leads Open Source Market, Gets Cluster...
- Oracle Announces Milestone Release for MySQL
- How to Stop SQL Injection Attacks
- New Defragmentation Solution for SQL Server
- Comparison of MyISAM and InnoDB MySQL Databa...


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 1 - Follow our Sitemap

Dev Shed Tutorial Topics: