PDA

View Full Version : strange problem with require



pusse
07-18-2005, 07:31 AM
Hi everybody. I have a strange problem and I hope someone could help me. I use in a page (contact.php) a script called with a require (require (footer.php)).
My problem is: when I call footer.php alone in my browserI have no problem but when I view contact.php in my browser, footer.php doesn't work. I give you the code. caan you help me please

footer.php
<style type="text/css">
a.typeOfProduct { font-family:Arial, Helvetica, sans-serif; color:#000000; font-size:15pt; text-decoration:none; }
/*a.typeOfProduct:hover { font-family:Arial, Helvetica, sans-serif; color:#000000; font-size:15pt; text-decoration:none; font-weight:bold; }*/
</style>

<script type="text/javascript">

/***********************************************
* Scrollable Menu Links- Dynamic Drive DHTML code library (www.dynamicdrive.com)
* Visit http://www.dynamicDrive.com for hundreds of DHTML scripts
* This notice must stay intact for legal use
***********************************************/

//configure path for left and right arrows
var goleftimage='../pictures/utilities/footer_leftArrow.jpg';
var gorightimage='../pictures/utilities/footer_rightArrow.jpg';
//configure menu width (in px):
var menuwidth=718;
//configure menu height (in px):
var menuheight=25;
//Specify scroll buttons directions ("normal" or "reverse"):
var scrolldir="normal";
//configure scroll speed (1-10), where larger is faster
var scrollspeed=6;
//specify menu content
var menucontents='<nobr> <a href="http://www.dynamicdrive.com" class="typeOfProduct">TYPE_PRODUCT_01</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="http://www.dynamicdrive.com" class="typeOfProduct">TYPE_PRODUCT_02</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="http://www.dynamicdrive.com" class="typeOfProduct">TYPE_PRODUCT_03</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="http://www.dynamicdrive.com" class="typeOfProduct">TYPE_PRODUCT_04</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="http://www.dynamicdrive.com" class="typeOfProduct">TYPE_PRODUCT_05</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="http://www.dynamicdrive.com" class="typeOfProduct">TYPE_PRODUCT_06</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="http://www.dynamicdrive.com" class="typeOfProduct">TYPE_PRODUCT_07</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="http://www.dynamicdrive.com" class="typeOfProduct">TYPE_PRODUCT_08</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="http://www.dynamicdrive.com" class="typeOfProduct">TYPE_PRODUCT_09</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="http://www.dynamicdrive.com" class="typeOfProduct">TYPE_PRODUCT_10</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="http://www.dynamicdrive.com" class="typeOfProduct">TYPE_PRODUCT_11</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="http://www.dynamicdrive.com" class="typeOfProduct">TYPE_PRODUCT_12</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="http://www.dynamicdrive.com" class="typeOfProduct">TYPE_PRODUCT_13</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="http://www.dynamicdrive.com" class="typeOfProduct">TYPE_PRODUCT_14</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="http://www.dynamicdrive.com" class="typeOfProduct">TYPE_PRODUCT_15</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="http://www.dynamicdrive.com" class="typeOfProduct">TYPE_PRODUCT_16</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="http://www.dynamicdrive.com" class="typeOfProduct">TYPE_PRODUCT_17FIN</a></nobr>';


////NO NEED TO EDIT BELOW THIS LINE////////////

var iedom=document.all||document.getElementById;
var leftdircode='onMouseover="moveleft()" onMouseout="clearTimeout(lefttime)"';
var rightdircode='onMouseover="moveright()" onMouseout="clearTimeout(righttime)"';

if (scrolldir=="reverse")
{
var tempswap=leftdircode;
leftdircode=rightdircode;
rightdircode=tempswap;
}

if (iedom) { document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-5000">'+menucontents+'</span>'); }

var actualwidth='';
var cross_scroll, ns_scroll;
var loadedyes=0;

function fillup()
{
if (iedom)
{
cross_scroll=document.getElementById? document.getElementById("test2") : document.all.test2;
cross_scroll.innerHTML=menucontents;
actualwidth=document.all? cross_scroll.offsetWidth : document.getElementById("temp").offsetWidth;
}
else if (document.layers)
{
ns_scroll=document.ns_scrollmenu.document.ns_scrollmenu2;
ns_scroll.document.write(menucontents);
ns_scroll.document.close();
actualwidth=ns_scroll.document.width;
}
loadedyes=1;
}

window.onload=fillup;

function moveleft()
{
if (loadedyes)
{
if (iedom&&parseInt(cross_scroll.style.left)>(menuwidth-actualwidth))
{
cross_scroll.style.left=parseInt(cross_scroll.style.left)-scrollspeed+"px";
}
else if (document.layers&&ns_scroll.left>(menuwidth-actualwidth)) { ns_scroll.left-=scrollspeed; }
}
lefttime=setTimeout("moveleft()",50);
}

function moveright()
{
if (loadedyes)
{
if (iedom&&parseInt(cross_scroll.style.left)<0) { cross_scroll.style.left=parseInt(cross_scroll.style.left)+scrollspeed+"px"; }
else if (document.layers&&ns_scroll.left<0) { ns_scroll.left+=scrollspeed; }
}
righttime=setTimeout("moveright()",50);
}

if (iedom||document.layers)
{
with (document)
{
write('<table border="0" cellspacing="0" cellpadding="2">');
write('<td valign="middle"><a href="#" '+leftdircode+'><img src="'+goleftimage+'"border=0></a> </td>');
write('<td width="'+menuwidth+'px" valign="top">');

if (iedom)
{
write('<div style="position:relative;width:'+menuwidth+'px;height:'+menuheight+'px;overflow:hidden;">');
write('<div id="test2" style="position:absolute;left:0;top:0">');
write('</div></div>');
}
else if (document.layers)
{
write('<ilayer width='+menuwidth+' height='+menuheight+' name="ns_scrollmenu">');
write('<layer name="ns_scrollmenu2" left=0 top=0></layer></ilayer>');
}
write('</td>');
write('<td valign="middle"> <a href="#" '+rightdircode+'>');
write('<img src="'+gorightimage+'"border=0></a>');
write('</td></table>');
}
}


</script>

contact.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>contact</title>
<link rel="stylesheet" type="text/css" href="../css/aboutTheCompany.css">
</head>

<body>
<?php $part = 'contact'; require ('../utilities/header.php'); ?>
<table width="760px" border="0" cellspacing="0" cellpadding="0">
<?php //------------------------------------------------------------------------------- text of contact ?>
<tr>
<td colspan="2" width="542px" height="238px" class="aboutTheCompany_leftBordure" valign="middle">
PAVO SALES <br>
adresse <br>
fax <br>
telephone <br>
numero TVA <br>
numero registre commerce <br>
plan acces <br>
nom banque - adresse <br>
numero compte <br>
swift <br>
</td>
</tr>
<?php //---------------------------------------------------------------------------------------------- end ?>
<tr>
<td width="14px" height="14px"><img src="../pictures/utilities/aboutTheCompany_bottomCorner.jpg" alt="" width="14px" height="14px"></td>
<td width="100%">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="13px"></td>
</tr>
<tr> <td height="1px" width="100%" bgcolor="#000000"></td> </tr>
</table>
</td>

</tr>
</table>
<?php //--------------------------------------------------------------------------------------------- footer ?>
<?php require ('../utilities/footer.php'); ?>
<?php //--------------------------------------------------------------------------------------------- end ?>
</body>
</html>

Twey
07-18-2005, 07:08 PM
Does it work if you don't call header.php?