Adding dynamic meta tags using php

Sites developed on PHP tend to have dynamic content. The user interacts with the site and based on the users actions; the PHP script runs on the server and the output is then displayed on the user. Below I will show you how to generate dynamic meta tags for your PHP powered site. This is particularly useful for shopping cart sites, although most modern shopping carts have this already built in.

Firstly, lets take a look at what a meta tag actually looks like below:

Now your site will have some way of retrieving information from a mysql database, in our example we will use a shopping cart site. Below is some of the data that is retrieved from our database and then the data is assigned to variables.

From here on in, its simple as pie. We simply echo the stored variables under the right meta tag as seen below.

Hope that was helpful to some of you, if this was helpful or you have a better way of achieving the same thing; let us know in the comments section below.

Leave a Reply

What is 14 + 8 ?
Please leave these two fields as-is:
IMPORTANT! To be able to proceed, you need to solve the following simple math (so we know that you are a human) :-)