arkansasdj Posted May 1, 2006 Share Posted May 1, 2006 [!--fonto:Verdana--][span style=\"font-family:Verdana\"][!--/fonto--]Ok so I am finaly getting around to learning a little PHP since I'm having some trouble geting ASP to run on my server.I'm trying to figure out how to do a simple Else statment to set in my top include file so that they page will dynamicly pull the correct header image for each interior page. I've searched the data base here and can't find anything that specificly addresses this particular configuration.thanks in advance.Jason [!--fontc--][/span][!--/fontc--] Quote Link to comment https://forums.phpfreaks.com/topic/8795-simple-subhead-img-replacement-question/ Share on other sites More sharing options...
AndyB Posted May 1, 2006 Share Posted May 1, 2006 Assuming each page is 'identifiable', then look at the switch() function. Simple tutuorial - [a href=\"http://www.plus2net.com/php_tutorial/php_switch.php\" target=\"_blank\"]http://www.plus2net.com/php_tutorial/php_switch.php[/a] Quote Link to comment https://forums.phpfreaks.com/topic/8795-simple-subhead-img-replacement-question/#findComment-32297 Share on other sites More sharing options...
arkansasdj Posted May 1, 2006 Author Share Posted May 1, 2006 What I am looking for is something that will take my header images and change them out based on which interior page is loaded.for instance if www.earonfloor.com/balance had a specific header image and www.earonfloor.com/events had a diffrent header image. I would like to have these header rules included in my int_top.php include file. I've hear rumors that this can be done with CSS. Any truth to that? I'd really like to see an example of a php solution though. Quote Link to comment https://forums.phpfreaks.com/topic/8795-simple-subhead-img-replacement-question/#findComment-32489 Share on other sites More sharing options...
AndyB Posted May 2, 2006 Share Posted May 2, 2006 um, that was exactly what I gave you. [b]IF[/b] the page is identifiable, then you can switch the header image.Trivial example, imagine that events.php looks like this:[code]<?php$page = "events"; // identifies specific page$page_css = "events.css"; // small specific css fileinclude("top.php"); // your normal page top stuff but see below[/code]And then you need to use a specific CSS file that only defines the header background image. For example, events.css:[code].header {background:url('../images/events.jpg') bottom left no-repeat;}[/code]Somewhere (presumably in your top.php file) is where the page-specific header definition gets used[code]<link rel="stylesheet" href="<?php echo $page_css;?>" type="text/css">[/code]That's the general idea. Quote Link to comment https://forums.phpfreaks.com/topic/8795-simple-subhead-img-replacement-question/#findComment-32491 Share on other sites More sharing options...
arkansasdj Posted May 2, 2006 Author Share Posted May 2, 2006 Thanks man. Helps a ton. Quote Link to comment https://forums.phpfreaks.com/topic/8795-simple-subhead-img-replacement-question/#findComment-32526 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.