PHP: Change image in a div depending on what page is loaded? -
I'm terrible in answering these questions, but I hope what I'm trying to do, it's a good idea is.
I have 7 pages and 7 images, pictures are all "waterfall_01.jpg", "waterfall_02.jpg", etc. 7.
I have code so far away:
& lt ;? Php $ cp = basename ($ _ server ['PHP_SELF']); $ Cf = dirname ($ _ server ['PHP_SELF']); ? & Gt; & Lt; Img src = "/ img / waterfall_0" php if ($ cp == "about.php" || $ cf == "/ about") {echo "1";}? & Gt; .jpg "/>
How do I change this code to resize a different number between 7 and 7 different pages (some of which are below the folders in a folder dropdown menu is shown).
Technically, I can actually write a very long line:
& lt; Img src = "/ img / waterfall_0"? Php if ($ cp == "home.php") {echo "1";} ($ cp == "about.php" || $ cf == "/ About ") {echo" 2 ";} if ($ cp ==" products.php "|| $ Cf ==" / products ") {echo" 3 ";} ($ cp ==" services.php "$ Cf ==" / services ") {echo" 4 ";} ($ cp =" Gallery.php "} $ cf ==" / gallery ") {echo" 5 ";} if ($ cp == "faq.php") {echo "6"; ($ cp == "Contact.php") {echo "7";}? & Gt; .jpg "/>
I am not so good with PHP yet, I'm not sure that the above is the best or the right way to do this so that all help is appreciated!
Test Server
Thank you in advance!
You need to use other
Comments
Post a Comment