Topic: html site map

copy and paste the applicable code to a new file named sitemap.php or something similiar. and link to it off your home page or footer...
on call the script generates a list of links to every listing using  the "sitetitle" as the anchor text. to list the "sitedesc" or use other fields follow the instructions in the code....also the 100 link per page rule does not apply to sitemap files, you can use as many as needed

for rewritten urls using this rewrite code

RewriteEngine on 
#RewriteRule ^~(.*)$ /profile.php?profile=$1 [L] 
RewriteRule ^([a-zA-Z0-9]*).html detail.php?siteid=$1

use this code

<?php
// HTML SITE MAP FOR REWRITTEN URLS

// SETTINGS TO BE EDITED 
$url = "http&#58;//www.domain.com/classifieds/" ;  // url to directory must have trailing slash
$title = "page title" ;   // page title 
$keywords = "keywords" ;          //  keywords
$metadesc = "description" ;          //  description of your site
$hostname_sitemap = "localhost";         // mysql location  
$database_sitemap = "xxxxxxxxxxxxxxxxx";  // mysql database
$username_sitemap = "xxxxxxxxxxx";        // mysql user 
$password_sitemap = "xxxxxxxxxx";        //  mysql password

//hmmmmm dunno what to say 
$sitemap = mysql_pconnect&#40;$hostname_sitemap, $username_sitemap, $password_sitemap&#41; or trigger_error&#40;mysql_error&#40;&#41;,E_USER_ERROR&#41;; 

// okay know let's hook up with our base and slide our query in
mysql_select_db&#40;$database_sitemap, $sitemap&#41;;
$query_Recordset1 = "SELECT * FROM ad";
$Recordset1 = mysql_query&#40;$query_Recordset1, $sitemap&#41; or die&#40;mysql_error&#40;&#41;&#41;;
$row_Recordset1 = mysql_fetch_assoc&#40;$Recordset1&#41;;
$totalRows_Recordset1 = mysql_num_rows&#40;$Recordset1&#41;;
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title><? echo $title ?></title>
<meta name="keywords" content="<? echo $keywords ?>">
<meta name="description" content="<? echo $metadec ?>">
</head>

<body>
<!-- start sitemap -->
<?php do &#123; ?>
<table width="100%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
<!-- start url list -->
    <td width="42%"><a href="<? echo $url ?><?php echo $row_Recordset1&#91;'siteid'&#93;; ?>.html" target="_blank"><?php echo $row_Recordset1&#91;'sitetitle'&#93;; ?> </td>
<!--  to add other database fields as links use this code   <a href="<? echo $url ?><?php echo $row_Recordset1&#91;'siteid'&#93;; ?>" target="_blank"></a>    to just print text use ?php echo $row_Recordset1&#91;'e_8'&#93;; ?> replacing  siteid or 8 with the needed database field -->
<td width="58%" rowspan="3" valign="top"><div align="center"></div></td>
  </tr>
  <tr>
<!-- start description-- to show the description simply remove the comment tages from in front -->
<!--   <td class="desc"><?php echo $row_Recordset1&#91;'sitedescription'&#93;; ?></td> 
<!-- end description -->
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
<!-- end item -->
<?php &#125; while &#40;$row_Recordset1 = mysql_fetch_assoc&#40;$Recordset1&#41;&#41;; ?>
<p></p>
</body>
</html>

for normal urls use this code

<?php
// HTML SITE MAP FOR NORMAL URLS

// SETTINGS TO BE EDITED 
$url = "http&#58;//www.domain.com/classifieds/" ;  // url to directory must have trailing slash
$page = "detail.php?siteid=";     //no need to edit 
$title = "page title" ;   // page title 
$keywords = "keywords" ;          //  keywords
$metadesc = "description" ;          //  description of your site
$hostname_sitemap = "localhost";         // mysql location  
$database_sitemap = "xxxxxxxxxxxxxxxxx";  // mysql database
$username_sitemap = "xxxxxxxxxxx";        // mysql user 
$password_sitemap = "xxxxxxxxxx";        //  mysql password

//hmmmmm dunno what to say 
$sitemap = mysql_pconnect&#40;$hostname_sitemap, $username_sitemap, $password_sitemap&#41; or trigger_error&#40;mysql_error&#40;&#41;,E_USER_ERROR&#41;; 

// okay know let's hook up with our base and slide our query in
mysql_select_db&#40;$database_sitemap, $sitemap&#41;;
$query_Recordset1 = "SELECT * FROM ad";
$Recordset1 = mysql_query&#40;$query_Recordset1, $sitemap&#41; or die&#40;mysql_error&#40;&#41;&#41;;
$row_Recordset1 = mysql_fetch_assoc&#40;$Recordset1&#41;;
$totalRows_Recordset1 = mysql_num_rows&#40;$Recordset1&#41;;
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title><? echo $title ?></title>
<meta name="keywords" content="<? echo $keywords ?>">
<meta name="description" content="<? echo $metadec ?>">
</head>

<body>
<!-- start sitemap -->
<?php do &#123; ?>
<table width="100%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
<!-- start url list -->
    <td width="42%"><a href="<? echo $url.$page ?><?php echo $row_Recordset1&#91;'siteid'&#93;; ?>" target="_blank"><?php echo $row_Recordset1&#91;'sitetitle'&#93;; ?> </td>
<!--  to add other database fields as links use this code   <a href="<? echo $url.$page ?><?php echo $row_Recordset1&#91;'siteid'&#93;; ?>.html" target="_blank"></a>    to just print text use ?php echo $row_Recordset1&#91;'e_8'&#93;; ?> replacing  siteid or 8 with the needed database field -->
<td width="58%" rowspan="3" valign="top"><div align="center"></div></td>
  </tr>
  <tr>
<!-- start description-- to show the description simply remove the comment tages from in front -->
<!--   <td class="desc"><?php echo $row_Recordset1&#91;'sitedescription'&#93;; ?></td> 
<!-- end description -->
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
<!-- end item -->
<?php &#125; while &#40;$row_Recordset1 = mysql_fetch_assoc&#40;$Recordset1&#41;&#41;; ?>
<p></p>
</body>

Thumbs up Thumbs down