Solved

$crumb="services" - navigation "over image" trick not working

Posted on 2006-10-26
4
176 Views
Last Modified: 2008-03-06
I've got:

<?php $crumb="services";?>

at the very top of my page: services/index.php

then in includes/header.php

i've got this:

<img src="<?php if ($crumb=="services") { echo "../images/nav/services-over.gif"; } else { echo "../images/nav/services.gif"; } ?>"

problem is the crumb isn't being spotted so i'm seeing services.gif and not services-over.gif .

here's the code from the top of services/index.php - thanks in advance for the help!

<?php $crumb="services";?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>
<? include 'http://www.healthpresence.com/familymedicine/site/includes/title.php'; ?> <? include 'http://www.healthpresence.com/familymedicine/site/includes/title-dr.php'; ?>
</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<? include 'http://www.healthpresence.com/familymedicine/site/includes/scripts.php'; ?>



</head>

<body onLoad="MM_preloadImages('../images/nav/about-over.gif','../images/nav/services-over.gif','../images/nav/forms-over.gif','../images/nav/insurance-over.gif','../images/nav/location-over.gif','../images/nav/home-over.gif')">
<div id="all">
<div id="container"><div id="content">
     <? include 'http://www.healthpresence.com/familymedicine/site/includes/header.php'; ?>
0
Comment
Question by:phillystyle123
  • 2
  • 2
4 Comments
 
LVL 48

Expert Comment

by:hernst42
ID: 17811811
include of remote urls does not propagate variables to the included php-file (even if it's on the same server)
The code should look like (pathen to includes from index.php might be wrong):

<?php $crumb="services";?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>
<? include '../familymedicine/site/includes/title.php'; ?> <? include '../familymedicine/site/includes/title-dr.php'; ?>
</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<? include ../familymedicine/site/includes/scripts.php'; ?>

</head>

<body onLoad="MM_preloadImages('../images/nav/about-over.gif','../images/nav/services-over.gif','../images/nav/forms-over.gif','../images/nav/insurance-over.gif','../images/nav/location-over.gif','../images/nav/home-over.gif')">
<div id="all">
<div id="container"><div id="content">
     <? include '../familymedicine/site/includes/header.php'; ?>

The the variable $crumb should be present in your header.php
0
 

Author Comment

by:phillystyle123
ID: 17812118
this is exactly what i already have:

<?php $crumb="services";?>

is at the top of my services.php page

and in my includes/header.php i have:

<a href="http://healthpresence.com/familymedicine/site/services/index.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('services','','http://healthpresence.com/familymedicine/site/images/nav/services-over.gif',1)"><img src="<?php if ($crumb=="services") { echo "http://healthpresence.com/familymedicine/site/images/nav/services-over.gif"; } else { echo "http://healthpresence.com/familymedicine/site/images/nav/services.gif"; } ?>" alt="Murdock Family Medicine - Services" name="services" width="54" height="26" border="0"></a>
0
 
LVL 48

Accepted Solution

by:
hernst42 earned 250 total points
ID: 17812335
Do you have the includes as I posted (no remote includes/without the http:/...)?
0
 

Author Comment

by:phillystyle123
ID: 17873330
hernst42  - that was exactly the problem - thanks for the help!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Dynamic Dropdowns 15 32
Change background color in td if any value is 1 9 24
How do I correctly structure this?   PHP / PDO / CSV download 1 20
Inserting data into database 10 36
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question