Jump to content


Photo

Simple SubHead Img Replacement Question


  • Please log in to reply
4 replies to this topic

#1 arkansasdj

arkansasdj
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 01 May 2006 - 04:18 AM

[!--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--]

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 01 May 2006 - 04:59 AM

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]
Legend has it that reading the manual never killed anyone.
My site

#3 arkansasdj

arkansasdj
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 01 May 2006 - 11:49 PM

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.

#4 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 02 May 2006 - 12:03 AM

um, that was exactly what I gave you. IF the page is identifiable, then you can switch the header image.

Trivial example, imagine that events.php looks like this:
<?php
$page = "events"; // identifies specific page
$page_css = "events.css"; // small specific css file
include("top.php"); // your normal page top stuff but see below
And then you need to use a specific CSS file that only defines the header background image. For example, events.css:
.header {
background:url('../images/events.jpg') bottom left no-repeat;
}
Somewhere (presumably in your top.php file) is where the page-specific header definition gets used
<link rel="stylesheet" href="<?php echo $page_css;?>" type="text/css">

That's the general idea.
Legend has it that reading the manual never killed anyone.
My site

#5 arkansasdj

arkansasdj
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 02 May 2006 - 04:01 AM

Thanks man. Helps a ton.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users