Jump to content
Larry Ullman's Book Forums

Currency


Recommended Posts

First of all...Thanks for producing some wonderful, easy to follow books. I've been trying to learn PHP & MYSQL for the past 18 months and your books have enabled me to understand how it all works and actually put together a couple of dynamic sites.

 

I've been working my way through this book over the past few months and have managed to solve all of the issues that have arisen by using this forum or Google. However I am a bit perplexed with what appears to be something simple.

 

On the Coffee site most of the prices (not all) are prefixed with the $sign (eg $7.50). Being based in the UK it's important that the £ sign is used in front of all the prices but just can't find a solution anywhere that would allow me to add it to all the prices.

 

Any thoughts?

Link to comment
Share on other sites

I assume you are talking about the second site example.

 

Page 214 ch8, in the #6 section "Print Each Item:" if you look in the example code for the line with "Price:" in it you will see the dollar sign, replace it with the EU sign.

 

I am sure there are places in other sections of code that shows the prices, just look there and find the dollar sign and replace with the sign you need it to be.

 

If you are going to offer both US and UK prices I would setup a variable and place it there instead and just replace the contents of the variable with the correct sign as needed.

  • Upvote 1
Link to comment
Share on other sites

A quicker way is to just do a find replace,

 

FIND -> $' or $'.

 

REPLACE -> E' OR if you searched for $'. replace with E'.

 

I don't know how to make the symbol so I just used E.

 

Make sure you do this manually and look at each place it wants to do a replace on because it may not be what you want replaced. Don't do a automatic find replace all.

 

DO NOT just do a search for $ or it will find ALL instances of variables everywhere in your code, and if there is no ' next to the dollar sign you need replaced the find wont find it. Verify in your web browser all the signs are replaced.

  • Upvote 1
Link to comment
Share on other sites

Thanks Terry.

 

Staring me in the face!

 

For anyone else in the UK...The files that need to be changed are cart.html and product_functions.inc.php.

 

The code for £ is £

Link to comment
Share on other sites

 Share

×
×
  • Create New...