

Using AJAX and PHP to Create Page Content Linked to Keywords in URL
This article is designed to give an overview of the processes involved in creating context sensitive content that is designed to generate revenue. It is important because no content-oriented site can exist just be serving up information; they have a need to sell something to support this activity. The trick is to:- Create themed content
- Isolate key phrases that buyers use to find products
- Give the buyers information
- Sell them what they want to buy
Context Sensitive Content
The dynamic content being served can be linked to one of two mechanisms:- linked to keywords within the content (AdSense model)
- linked to tags and queries in the URL (ad-hoc model)
Placeholders & Integration with CMS
On the page itself HTML div elements are used to to create special areas of HTML. These can then be accessed by name, and their properties set (show/hide, for example) using JavaScript. The innerHTML property is also set dynamically to reflect the contents of the data source used to populate the dynamic content (affiliate sales links, adverts etc.). This HTML can be generated on the front-end (using JavaScript ; AJAX) or the backend (using PHP). It is then just a case of pulling tags from the URL using JavaScript string.split (as described in the Dynamic Redirect with JavaScript article) or keywords from the source, and creating a query to retrieve up to date content from a server or another web site. For example, if serving pay per click adverts, like Google AdSense does, PHP could be used on the backend to read adverts from a database.Data Sources
Other data sources for affiliate products and services include:- Amazon via REST interface
- XML & RSS Feeds from providers such as YouTube, eBay, etc.
- Mashup providers such as Yahoo! Pipes & Feed43.com
- Specialized API such as Google’s GDATA
www.server.com/list_products.php?keywords=key+words&affiliate=aff_id
The result is commonly an XML tree that can be processed via PHP or JavaScript (the AJAX approach).