create a new html page using a mysql content management and php
Hello
I am creating a content management system that will hold products, the admin will be able to add new products, however when a new product is added a new page on the website will need to be created displaying that products information. Is it possible to add a new item to the database and use php to make sure that every time a new product is created a new html page will be created? If that makes any sense?
The most efficient way to handle this would be to use a product template page which is then populated with the specific product information from the database.
The template page would contain the basic HTML structure of your product page, but with blanks/placeholders where the actual product information would be. You'd link to the page using something like
product.php?productid=666
where 666 is the product id within the database. This would load, querying the database for the data for product 666. The page would then insert the product information into the blanks in the template, displaying a product page for the required product.
This would allow you to use one physical template file to display all your products.
(You can use htaccess files and URL rewriting to allow for URLs which are friendlier both for your users and search engines, mapping the URL
blah.com/products/666 (this is the URL your users / search engines sees)
to
blah.com/product.php?product_id=666 (this is the URL which the web server processes)
Search for 'php template engines' and 'url rewriting' for further information.
Bookmarks