Forum Moderators: coopster

Message Too Old, No Replies

static html with one dynamically served line?

static html with one dynamically served line?

         

stickytoffee

1:24 pm on Oct 14, 2004 (gmt 0)



Can any PHP gurus help please?

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)

kumarsena

2:04 pm on Oct 14, 2004 (gmt 0)

10+ Year Member



possible, buti wouldrecommend database my friend, makesthing so much easier. that way u can change everythingin one place.not just the price..

mincklerstraat

2:26 pm on Oct 14, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



kumar's idea is very good - db gives you awesome power and very easy updates. There are a lot of 'out-of-the-box' solutions ready for you if you want to go this route, many free.

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.

stickytoffee

5:41 pm on Oct 26, 2004 (gmt 0)



Thanks for the suggestions guys :o)