Forum Moderators: coopster
I've a site with static HTML product pages. I would like to make the price on these pages dynamic so that when all of the prices change, rather than change them on each individual page, I can just change them in one place.
But just the price in the list of product details that I wanted to serve dynamically.
I've had a couple of posts back from my first query who say PHP is the way to go, so I thought that I'd come to the masters and check it would be able to do this?
Any suggestions very gratefully received! :o)
If you already have something implemented and don't to change programs, or learn how to implement a db (can take a few days, or weeks if it's just a bit of time each day) then you can get something up and going real fast with simple php for that 'one line' that's got the price.
Use htaccess so php also parses your html files as they stand, here's a thread on doing that: [webmasterworld.com...] .
In each of your pages with prices, begin the page with <?php
include $_SERVER["DOCUMENT_ROOT"].'/prices.php'
?>
this loads in the file with your price information.
In the file prices.php, give each price a name and make your file like this:
<?php
$blue_widget_price = '100.00';
$red_widget_price = '87.00';
?>
And then in each html file where you want these prices to show, it's like this:
<td>Our blue widgets cost <?php echo $blue_widget_price;?></td><td>Our red widgets cost <?php echo $red_widget_price;?>
Like that. Primitive, but easy.