#native_company# #native_desc#
#native_cta#

Revisited: Build Dynamic Pages With Search Engines in Mind Page 3

By Tim Perdue
on July 30, 2000

Let’s go into more detail now:

<?php

//sample shared.inc file

//set up database connections

//any global variables for background

//      colors or path names

function site_header($title) {

    //contains common HTML

    //for the header

    
echo '<HTML>

        <HEAD>

        <TITLE>PHPBuilder.com - '
.$title.'</TITLE>';

    //set up metatags

    //take out "the", "and" and "a"

    //a truly gifted developer would use 

    //a great Regular Expression here

    
$keywords=str_replace("the ",'',strtolower($title));

    
$keywords=str_replace("a ",'',$keywords);

    
$keywords=str_replace("and ",'',$keywords);

    
$keywords=str_replace(""",'',$keywords);

    //make the string comma-separated

    
$meta_array=explode(' ',$keywords);

    
$meta_words=implode($meta_array,', ');

    echo '

        <META NAME="KEYWORDS" CONTENT="PHP, '
.$meta_words.'">

        <META NAME="DESCRIPTION" CONTENT="PHP Developer, Web Developer, '
.$title.'">

    '
;

    echo '</HEAD>

    <BODY TEXT="#000099" BGCOLOR="#FFFFFF">';

}

function site_footer() {

    //contains common html

    //for the footer

    echo '</BODY></HTML>';

}

?>



There, now the site_header() function prints out the usual stuff + meta tags that are built
from the $title string that you pass in. For best results, use a descriptive title on your pages.
On the next page, I’ll show you you how to use the URL string to create a hierarchy.