Drew Posted May 30, 2011 Share Posted May 30, 2011 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 More sharing options...
Terry Posted May 30, 2011 Share Posted May 30, 2011 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. 1 Link to comment Share on other sites More sharing options...
Terry Posted May 30, 2011 Share Posted May 30, 2011 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. 1 Link to comment Share on other sites More sharing options...
Terry Posted May 30, 2011 Share Posted May 30, 2011 You should be able to do a find replace in ALL files in a folder so you don't manually have to open each file one at a time. Depends on your editor or IDE you use. Link to comment Share on other sites More sharing options...
Drew Posted May 30, 2011 Author Share Posted May 30, 2011 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 More sharing options...
HartleySan Posted May 31, 2011 Share Posted May 31, 2011 Glad you found the answer, Drew. Was just about to say that there is probably an HTML entity for the pound sign, and sure enough, there is. Link to comment Share on other sites More sharing options...
Larry Posted May 31, 2011 Share Posted May 31, 2011 And thanks for the nice words on the books! Link to comment Share on other sites More sharing options...
Recommended Posts