Hiikaru Posted November 16, 2009 Share Posted November 16, 2009 How can I replace all images on the site under the condition that the user tells them to be replaced? So I have a Pokemon game where you can choose to play with a different Pokemon. But since you guys aren't necessarily familiar with them, we'll call these Pokemon kitty, puppy, and dragon, to keep it simple. The main character that you play with is the kitty. You can feed it, brush it, etc. When you click on the feed or whatever button, it goes to a page that plays an animation of that. What I want to do is have an option on the navigation bar that goes to a page where you can switch characters. Instead of the navigation bar, it should display a back button, and then all the types of characters you can switch to. It will show the option to play with the puppy, and if you have enough "points" (happiness points? Money? I don't know), then you also have the option to play with the dragon. I don't want to use subdirectories. The url should still be game.mysite/page.php, not game.mysite/puppy/page.php, although I'm not opposed to having query strings at the end if I need them. Then when you switch to puppy or dragon, it replaces all the images/kitty/ code to images/puppy/ or images/dragon/ (assuming that replacing those is the best way to go about this). And it keeps this change until you leave the site, or switch characters again (either both or just the second one, if you can switch back by yourself then you can just do that when you come back to the site). I was thinking I could use a PHP switch, but I don't want it to be in a drop down menu, just images that you click to make the switch, and also I want it to stay for all pages, and the PHP switch that I wrote can only keep it for one page at a time. And shopping cart scripts seem similar to what I want to do, but maybe not really right. Plus I want the dragon and some other rarer characters to be based on a points system, and I don't know how I can implement that into a shopping cart script. Also, by the way I don't care too much about PHP security, because it's a personal project and definitely not googleable, so if an easy method is insecure then it's probably fine. What would be the best way to accomplish this? Link to comment https://forums.phpfreaks.com/topic/181672-how-to-replace-all-images-conditionally/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.