How to build a database driven website part 3
In parts one and two we looked at the initial database set up, inserting data into our database using csv and sql files, layout and content issues, relative to both using our database and how we can use other providers to both add value and gain additional income revenue; as well as url and navigational topics relative to getting the most from our page templates and site structure.
In this part we are going to look at a typical hotel content page and see how we can best maximise the data we have.
As we already know, we have a database that is made of two distinct tables. The tables have a number of fields that we are going to use to populate our page. Unlike the umbrella pages that we previously looked at, we are going to use all of the data we have to create a unique page for each hotel.
To recap we have a number of fields that can be loosely classified as follows
Locational and contact information
`name` `address1` `address2` `town` `county` `region` `postcode` `country` `ename` `phone` `www` `email` `etype` `trainstation` `tsdist` `airport` `adist`
Pricing, payment and quality information
`price` `currency“rating“testimonials` `visa` `mastercard` `diners` `amex`
Detail and facility information
`numrooms` `photourl` `description` `lifts` `restaurant` `bar` `disabled` `parking` `childrates` `tv` `ensuite` `fax` `computer` `pets` `nonsmoking` `roomservice` `breakfast` `childcare` `attractions`
`custype` `date` `ipadd` `username` `password` `renewal`
We wont worry too much about our admin information as that doesn’t really pertain to what we intend to output to our visitors.
Our page is outputed as per the picture below. You will notice that each aspect of our page is labelled with some of the field variables above.
Our page with db variable labels
Our next graphic is similar, but shows the key html tags that we use to display our variables. Ive omitted tags like table and div and and have just shown the key html tags that are used to give our target keywords emphasis. HTML tags such as Hn, blockquotes, P, B, and I can be used to place extra emphasis on certain words or phrases. The short theory is that we send a message to the reader and the bots, that the page is primarily relatedto our most emphasised words and phrases, usually by way of a mix of repetition and placement within our page.
Maximising our data inside key html tags
Outputting our page
To output our page we need to query our databse.
We start our database query and hotel page output by using a variable called $hotelid which we access from the url with a little help from our modrewrite contained within our .htaccess file.
RewriteRule hotels-in-(.*).htm$ /county/index.php?place=$1
RewriteRule (.*)-hotels.htm$ /town/index.php?place=$1
RewriteRule hotel-(.*).htm$ /hotels/index.php?hotelid=$1
We are now ready to output our database variables inside our chosen key html tag holders.
Using tags as the html gods intended
The most important aspect of any page is the title tag. (Note the highlighted $trow[ename] variable in the graphic above.)
The title tag frames the page. It is what we see in our web browsers when we open a page up there in the blue bar. We also see it within results appearing in the so called SERPs or search engine results pages. Its our one opportunity to gain the search engine users attention, so its important for it to be as relevant to the content of our page as is humanly possible. We want that click!
Our page itself should be framed like we would any paper document, logical headings, indentations, lists, bolding, the usual formatting suspects that give form and structure to what we write. The slight difference with electronic documents is that instead of using ink and heavy strokes or typefaces, we are using html tags.
Search engines give weight to different tags dependant upon placement and context. We can help them rank pages or score them, by structuring our content in logical ways. So, a heading would be contained within a H1 tag, a secondary heading a h2 tag a relevant quote or set of words central to our topic might be bolded or quoted using the blockquote tag,or an ordered or unordered list with bulleted points and so on and so forth.*
Writing our content and thinking abouthow our visitors might find us..
As our page progresses, we place secondary emphasis on our locational variables and tie them in with our detail and facility variables. One reason why we do this is because a visitor from say a search engine, might well enter a query “hotel in woolmer that accepts visa cards” or “hotel in Woolmer that has free parking” or “hotel in woolmer close to the train station” etc. By outputting the words on our pages and framing them in certain ways, almost thinking about how our users might use the search engines we target, we can again as result, increase the likelihood of our page being returned, thus gaining traffic and visitors.
To further illustrate this it might be a good idea to look at 2 examples of how good and bad copywriting can make a big difference. Note the subtleties and ask yourself which method you believe would be more conducive to both a user and a search bot..no prizes of course, it really is elementary stuff, but you’d be amazed at how many people miss the whole plot.
- The nearest main line train station to the Hotel Crown INN Woolmer is ChooTown central
- Train station:ChooTown Central
Yep you guessed right, the 1st line would be a whole lot more effective at catching a broader range of queries. Whereas the 2nd line is just too basic. Same info, different style, very different possible returns.
Ive ran out of time to continue right now, but will come back and address things like modrewrite and .htaccess. I’ll also write a little more about some of the thinking behind good navigational structure, as well as a few others that will no doubt, spring to mind whilst i go about my day to day business!
Note:It is folly to confuse page structure with page format. HTML tags can be reformatted in terms of shape size placement and visibilty by using css. Css should not be used to lend the appearance of structure, we should always try and stick with what the w3c have to say on the topic. Besides the benefits that may flow to the aurally or visually impaired, there may also be a slight advantage from a Search engine perspective, as well as a distinctive disadvantage for any perceived abuse.Posted on: 7th February 2007, by : Rob Watts