Tutorial created by Christopher West, Freelancer Looking for Work
Categories: Data Bridge
This tutorial explains how to create a simple backend system for the website admin to manage certain aspects of SEO of their website.
The database table ...
Ok, keeping things simple as possible I will create a basic MySQL database table this will contain the metatags for Title, Description & Keywords as well as a field to store the metatag for robots and lastly a field that will store the page location (the page location will be used for what ever page your referencing using a simple recordset on that page (i.e. for the homepage which would be index.php I will reference this in the database table as Location = Homepage in the recordset in index.php so that it will pull in the data from the database for that particular page.
CREATE TABLE IF NOT EXISTS `seo` (
`SEOID` int(11) NOT NULL AUTO_INCREMENT,
`SEOTitle` varchar(255) NOT NULL,
`SEOLocation` varchar(100) NOT NULL,
`SEODescription` varchar(255) NOT NULL,
`SEOKeywords` varchar(255) NOT NULL,
`SEORobots` varchar(17) NOT NULL,
PRIMARY KEY (`SEOID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
<form method="get" name="seoupdate">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<td width="30%"><select name="Location">
<td><input name="Title" type="text" id="Title" maxlength="255"></td>
<td><input name="Description" type="text" id="Description" maxlength="255"></td>
<td><input name="Keywords" type="text" id="Keywords" maxlength="255"></td>
<option value="index, follow">index, follow</option>
<option value="index, nofollow">index, nofollow</option>
<option value="noindex, follow">noindex, follow</option>
<option value="noindex, nofollow">noindex, nofollow</option>
<td><input name="Submit" type="submit" value="Submit" ></td>
Create a connection to the database and create a recordset on the index.php and using the Location field to filter the table for Homepage ...
Then add the bindings for title, description, keywords and robots to the same parts of the html code with the same names:
<title><?php echo $row_rsSEO['SEOTitle']; ?></title>
<meta name="Description" content="<?php echo $row_rsSEO['SEODescription']; ?>">
<meta name="Keywords" content="<?php echo $row_rsSEO['SEOKeywords']; ?>">
<meta name="robots" content="<?php echo $row_rsSEO['SEORobots']; ?>">
First we need to add a recordset to the update page (since this will be used for "any" pages it needs to be filtered with a URL Parameter).
To bring this URL Parameter into this page you would generally have a link in your admin area something like this
<a href="seo-update.php?SEOLocation=Homepage">Update Homepage</a>
You then need to create a recordset and filter the SEOLocation field from the database as URL Parameter.
Then add bindings to each of the fields, with the select lists you need to click on the select box on the form then in the Properties panel click Dynamic icon which will then open up a new panel, from there click on the small lightening bolf where it says "SELECT value equal to:" then select the SEORobots field from the recordset.
In the general tabmake the trigger the forms button, then select the database base in the connection dropdown, select the table that you created earlier and the Key Column would be the SEOLocation field ... For the value you would then click on the small lightening bold and select SEOLocation from the recordset ...you can then enter the optional page for the After Update (this would go to what ever page you want it to go to after the update has processed).
In the Bindings tab you would then click on the small lightening bolt in turn for each of the form elements corrisponding to the table names.
Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.
These out-of-the-box solutions provide you proven, tested applications that can be up and running now. Build a store, a gallery, or a web-based email solution.
Comments will be sent to the author of this tutorial and may not be answered immediately. For general help from WebAssist, please visit technical support.Sign in to add comments