baseline Posted May 30, 2003 Posted May 30, 2003 server17 here regarding PHP for almost a month now, i've noticed all the pages where i use a php include would load very slowly and sometimes even fail to perform the php include. i've since removed php include on some pages and pasted code to be included directly and it has sped up significantly for those pages. the exact same page using the include method still loads very slowly or fails the inclusion. i didn't have problems using a this method before, so i'm just wondering whats up. Quote
Head Guru Posted May 30, 2003 Posted May 30, 2003 Please dont bump threads that are an hour old. Quote
Head Guru Posted May 30, 2003 Posted May 30, 2003 Give me some more to work with. Very hard to track a php issue with what you have listed. Quote
TCH-JimE Posted May 30, 2003 Posted May 30, 2003 Hi, Please provide examples of the code that you where having problems with. Thanks Jim Quote
natimage Posted May 30, 2003 Posted May 30, 2003 Morning all... After learning the php include() concept and trying it out, I got it to work and actually look almost correct yesterday. I also experienced some problems with my page loading. Seemed to be something to do with my javascript. The page would appear okay, however, it was a little slower than usual and the rollover images for the navigation bar were VERY slow and actually gave me a page error upon the first load. Then when I would refresh the page, I got no errors and everything was fine. The nav. bar was created in Fireworks. I will post code below. I apologize now for some of it being lengthy. I'll delete some of the plain ole' html if I can. OH, and, please don't call my code messy. It's very sensitive right now and working hard to improve it's appearance!! Code from parent.php: ><?php include $_server['document_root']."inc/parent1H.htm"; ?> <tr align="center" valign="top"> <td height="323" align="center" valign="top" class="cellbrder"><!-- TemplateBeginEditable name="Body" --> <h2>A Little About The...Blah, Blah, Blah... ...just plain ole' html...no problems loading here... <!-- TemplateEndEditable --> <p align="center"></p> <h5 align="center"><img src="../Images/spirulea.gif" alt="bar" width="530" height="10" border="0"> </h5> </td> <?php include $_server['document_root']."inc/parent1F.htm"; ?> Code from parent1H.htm (sorry this one is so long): ><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Natural Images Photography Home Page</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script language="JavaScript" type="text/JavaScript"> <!-- // (C) 2000 www.CodeLifter.com // http://www.codelifter.com // Free for all users, but leave in this header // Set the message for the alert box am = "This function is disabled!"; // do not edit below this line // =========================== bV = parseInt(navigator.appVersion) bNS = navigator.appName=="Netscape" bIE = navigator.appName=="Microsoft Internet Explorer" function nrc(e) { if (bNS && e.which > 1){ alert(am) return false } else if (bIE && (event.button >1)) { alert(am) return false; } } document.onmousedown = nrc; if (document.layers) window.captureEvents(Event.MOUSEDOWN); if (bNS && bV<5) window.onmousedown = nrc; <!-- function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } //--> function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_nbGroup(event, grpName) { //v6.0 var i,img,nbArr,args=MM_nbGroup.arguments; if (event == "init" && args.length > 2) { if ((img = MM_findObj(args[2])) != null && !img.MM_init) { img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src; if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array(); nbArr[nbArr.length] = img; for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) { if (!img.MM_up) img.MM_up = img.src; img.src = img.MM_dn = args[i+1]; nbArr[nbArr.length] = img; } } } else if (event == "over") { document.MM_nbOver = nbArr = new Array(); for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) { if (!img.MM_up) img.MM_up = img.src; img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] : img.MM_up); nbArr[nbArr.length] = img; } } else if (event == "out" ) { for (i=0; i < document.MM_nbOver.length; i++) { img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; } } else if (event == "down") { nbArr = document[grpName]; if (nbArr) for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; } document[grpName] = nbArr = new Array(); for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) { if (!img.MM_up) img.MM_up = img.src; img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up; nbArr[nbArr.length] = img; } } } //--> </script> <meta name="keywords" content="photography colorado photographer landscapes water animals freelance photo gorilla silverback lion flamingo elephant ibex nubian tiger eagle flag chaffe mountain peak snow fall aspen colors tree river white roaring fork national forest florissant hornbek rodeo meeker rangecall ice independence pass champion elbert twin lakes "> <meta name="description" content="Beautiful photography from Colorado and a few other places including mountains, water, sunsets, rainbows, animals, etc."> <link href="../main.css" rel="stylesheet" type="text/css"> </head> <body bgcolor="#FFFFFF" text="#003333" link="#669999" vlink="#336699" alink="#336666" onLoad="MM_preloadImages ('../Images/spnavuphome.gif','../Images/spnavupnews.gif','../Images/spnavupgall.gif','../Images/spnavuplinks.gif','../Images/spnavupcont.gif',' ../Images/Nav/HOME_f3.gif','../Images/Nav/HOME_f2.gif','../Images/Nav/navbar_r1_c4_f2.gif','../Images/Nav/navbar_r1_c4_f3.gif',' ../Images/Nav/navbar_r1_c5_f3.gif','../Images/Nav/navbar_r1_c5_f2.gif','../Images/Nav/navbar_r1_c9_f3.gif','../Images/Nav/navbar_r1_c9_f2.gif',' ../Images/Nav/navbar_r1_c12_f2.gif','../Images/Nav/navbar_r1_c12_f3.gif','../Images/Nav/navbar_r1_c13_f3.gif','../Images/Nav/navbar_r1_c13_f2.gif',' ../Images/Nav/RESOURCES_f3.gif','../Images/Nav/RESOURCES_f2.gif','../Images/Nav/navbar_r1_c21_f3.gif','../Images/Nav/navbar_r1_c21_f2.gif')" > <table width="755" height="100%" align="center" background="../Images/spitxtr.jpg" class="tablebrdr"><!--DWLayoutTable--> <tr align="center"> </tr> <td width="201" rowspan="5" align="center" valign="top" class="cellbrder"> <img src="../Images/Bargraphic2.jpg" width="201" height="1007"> </td> <td width="530" height="166" align="center" valign="top" bordercolordark="#346969" class="cellbrder"> <p align="center" class="Text"><img src="../Images/logoLittle2.gif" width="400" height="162"> </p> </td> <tr align="center" valign="bottom" class="bnnrbrder"> <td height="26" align="center" valign="top" class="cellbrder"><table border="0" cellpadding="0" cellspacing="0" width="523"> <!-- fwtable fwsrc="navbar.png" fwbase="navbar.gif" fwstyle="Dreamweaver" fwdocid = "742308039" fwnested="0" --> <tr> <td><img src="../Images/Nav/spacer.gif" alt="" name="undefined_2" width="68" height="1" border="0"></td> <td><img src="../Images/Nav/spacer.gif" alt="" name="undefined_2" width="13" height="1" border="0"></td> <td><img src="../Images/Nav/spacer.gif" alt="" name="undefined_2" width="9" height="1" border="0"></td> <td><img src="../Images/Nav/spacer.gif" alt="" name="undefined_2" width="3" height="1" border="0"></td> <td><img src="../Images/Nav/spacer.gif" alt="" name="undefined_2" width="69" height="1" border="0"></td> <td><img src="../Images/Nav/spacer.gif" alt="" name="undefined_2" width="1" height="1" border="0"></td> <td><img src="../Images/Nav/spacer.gif" alt="" name="undefined_2" width="11" height="1" border="0"></td> <td><img src="../Images/Nav/spacer.gif" alt="" name="undefined_2" width="11" height="1" border="0"></td> <td><img src="../Images/Nav/spacer.gif" alt="" name="undefined_2" width="47" height="1" border="0"></td> <td><img src="../Images/Nav/spacer.gif" alt="" name="undefined_2" width="1" height="1" border="0"></td> <td><img src="../Images/Nav/spacer.gif" alt="" name="undefined_2" width="21" height="1" border="0"></td> <td><img src="../Images/Nav/spacer.gif" alt="" name="undefined_2" width="1" height="1" border="0"></td> <td><img src="../Images/Nav/spacer.gif" alt="" name="undefined_2" width="50" height="1" border="0"></td> <td><img src="../Images/Nav/spacer.gif" alt="" name="undefined_2" width="20" height="1" border="0"></td> <td><img src="../Images/Nav/spacer.gif" alt="" name="undefined_2" width="1" height="1" border="0"></td> <td><img src="../Images/Nav/spacer.gif" alt="" name="undefined_2" width="3" height="1" border="0"></td> <td><img src="../Images/Nav/spacer.gif" alt="" name="undefined_2" width="88" height="1" border="0"></td> <td><img src="../Images/Nav/spacer.gif" alt="" name="undefined_2" width="5" height="1" border="0"></td> <td><img src="../Images/Nav/spacer.gif" alt="" name="undefined_2" width="8" height="1" border="0"></td> <td><img src="../Images/Nav/spacer.gif" alt="" name="undefined_2" width="9" height="1" border="0"></td> <td><img src="../Images/Nav/spacer.gif" alt="" name="undefined_2" width="84" height="1" border="0"></td> <td><img src="../Images/Nav/spacer.gif" alt="" name="undefined_2" width="1" height="1" border="0"></td> </tr> <tr> <td><a href="javascript:;" target="_top" onClick="MM_nbGroup('down','navbar1','HOME','../Images/Nav/HOME_f3.gif', 'navbar_r1_c4','../Images/Nav/navbar_r1_c4_f3.gif',1);" onMouseOver="MM_nbGroup('over','HOME','../Images/Nav/HOME_f2.gif',' ../Images/Nav/HOME_f3.gif','navbar_r1_c4','../Images/Nav/navbar_r1_c4_f2.gif','../Images/Nav/navbar_r1_c4_f3.gif',1);" onMouseOut="MM_nbGroup('out');"><img name="HOME" src="../Images/Nav/HOME.gif" width="68" height="21" border="0" alt=""></a></td> <td colspan="2"><img name="SPACE1" src="../Images/Nav/SPACE1.gif" width="22" height="21" border="0" alt=""></td> <td><a href="javascript:;" target="_top" onClick="MM_nbGroup('down','navbar1','navbar_r1_c4','../Images/Nav/HOME_f3.gif', 'navbar_r1_c4','../Images/Nav/navbar_r1_c4_f3.gif',1)" onMouseOver="MM_nbGroup('over','navbar_r1_c4','../Images/Nav/HOME_f2.gif',' ../Images/Nav/HOME_f3.gif','navbar_r1_c4','../Images/Nav/navbar_r1_c4_f2.gif','../Images/Nav/navbar_r1_c4_f3.gif',1)" onMouseOut="MM_nbGroup('out');"><img name="navbar_r1_c4" src="../Images/Nav/navbar_r1_c4.gif" width="3" height="21" border="0" alt=""> </a></td> <td colspan="2"><a href="javascript:;" target="_top" onClick="MM_nbGroup('down','navbar1','navbar_r1_c5',' ../Images/Nav/navbar_r1_c5_f3.gif',1);" onMouseOver="MM_nbGroup('over','navbar_r1_c5','../Images/Nav/navbar_r1_c5_f2.gif',' ../Images/Nav/navbar_r1_c5_f3.gif',1);" onMouseOut="MM_nbGroup('out');"><img name="navbar_r1_c5" src="../Images/Nav/navbar_r1_c5.gif" width="70" height="21" border="0" alt=""></a></td> <td colspan="2"><img name="SPACE2" src="../Images/Nav/SPACE2.gif" width="22" height="21" border="0" alt=""></td> <td colspan="2"><a href="javascript:;" target="_top" onClick="MM_nbGroup('down','navbar1','navbar_r1_c9',' ../Images/Nav/navbar_r1_c9_f3.gif','navbar_r1_c12','../Images/Nav/navbar_r1_c12_f3.gif',1);" onMouseOver="MM_nbGroup('over','navbar_r1_c9',' ../Images/Nav/navbar_r1_c9_f2.gif','../Images/Nav/navbar_r1_c9_f3.gif','navbar_r1_c12','../Images/Nav/navbar_r1_c12_f2.gif',' ../Images/Nav/navbar_r1_c12_f3.gif',1);" onMouseOut="MM_nbGroup('out');"><img name="navbar_r1_c9" src="../Images/Nav/navbar_r1_c9.gif" width="48" height="21" border="0" alt=""></a></td> <td><img name="SPACE3" src="../Images/Nav/SPACE3.gif" width="21" height="21" border="0" alt=""></td> <td><a href="javascript:;" target="_top" onClick="MM_nbGroup('down','navbar1','navbar_r1_c12',' ../Images/Nav/navbar_r1_c9_f3.gif','navbar_r1_c12','../Images/Nav/navbar_r1_c12_f3.gif',1)" onMouseOver="MM_nbGroup ('over','navbar_r1_c12','../Images/Nav/navbar_r1_c9_f2.gif','../Images/Nav/navbar_r1_c9_f3.gif','navbar_r1_c12','../Images/Nav/navbar_r1_c12_f2.gif',' ../Images/Nav/navbar_r1_c12_f3.gif',1)" onMouseOut="MM_nbGroup('out');"><img name="navbar_r1_c12" src="../Images/Nav/navbar_r1_c12.gif" width="1" height="21" border="0" alt=""></a></td> <td><a href="javascript:;" target="_top" onClick="MM_nbGroup('down','navbar1','navbar_r1_c13',' ../Images/Nav/navbar_r1_c13_f3.gif',1);" onMouseOver="MM_nbGroup('over','navbar_r1_c13','../Images/Nav/navbar_r1_c13_f2.gif',' ../Images/Nav/navbar_r1_c13_f3.gif',1);" onMouseOut="MM_nbGroup('out');"><img name="navbar_r1_c13" src="../Images/Nav/navbar_r1_c13.gif" width="50" height="21" border="0" alt=""></a></td> <td colspan="2"><img name="SPACE4" src="../Images/Nav/SPACE4.gif" width="21" height="21" border="0" alt=""></td> <td><img name="navbar_r1_c16" src="../Images/Nav/navbar_r1_c16.gif" width="3" height="21" border="0" alt=""></td> <td><a href="javascript:;" target="_top" onClick="MM_nbGroup('down','navbar1','RESOURCES',' ../Images/Nav/RESOURCES_f3.gif',1);" onMouseOver="MM_nbGroup('over','RESOURCES','../Images/Nav/RESOURCES_f2.gif',' ../Images/Nav/RESOURCES_f3.gif',1);" onMouseOut="MM_nbGroup('out');"><img name="RESOURCES" src="../Images/Nav/RESOURCES.gif" width="88" height="21" border="0" alt=""></a></td> <td colspan="3"><img name="SPACE5" src="../Images/Nav/SPACE5.gif" width="22" height="21" border="0" alt=""></td> <td><a href="javascript:;" target="_top" onClick="MM_nbGroup('down','navbar1','navbar_r1_c21',' ../Images/Nav/navbar_r1_c21_f3.gif',1);" onMouseOver="MM_nbGroup('over','navbar_r1_c21','../Images/Nav/navbar_r1_c21_f2.gif',' ../Images/Nav/navbar_r1_c21_f3.gif',1);" onMouseOut="MM_nbGroup('out');"><img name="navbar_r1_c21" src=" ../Images/Nav/navbar_r1_c21.gif" width="84" height="21" border="0" alt=""></a></td> <td><img src="../Images/Nav/spacer.gif" alt="" name="undefined_2" width="1" height="21" border="0"></td> </tr> </table> </td> <tr align="center" valign="bottom" class="bnnrbrder"> <td height="33" valign="top" class="cellbrder"><img src="../Images/spirulea.gif" alt="bar" width="530" height="10" border="0"></td> Code for parent1F.htm: ><tr align="center" valign="top"> <td height="453" align="center" valign="bottom" class="cellbrder"> <h2><span class="TextBlue"><br>Contact Information</span></h2> <span class="smallh4grn">Tracy Smith PO Box 1446 Meeker, CO 81641<br> 970)878-0797 or (719)661-0627<br> email me at <a href="mailto:tsmith@naturalimagesweb.com">tsmith@naturalimagesweb.com</a><br> Web Design by Tracy Smith</span><br> <span class="smallh4blue"> This page was last updated: <!-- #BeginDate format:Am1 -->May 29, 2003<!-- #EndDate --> <br>All contents ©2003 Tracy Smith All Rights Reserved</span></td> </table> </body> </html> All the code, except the php include() code, came straight from a functioning page. My graphics are always a little slow on a dial-up, but I never got any errors before. You can check out the site page at www.naturalimagesweb.com/parent.php. Tracy Quote
surefire Posted May 30, 2003 Posted May 30, 2003 Bill, sorry about the 'bump'. Won't don't it again. I could've sworn I looked at the time the message was posted and figured it had been several hours... obviously I was wrong. Mea culpa. Quote
natimage Posted May 30, 2003 Posted May 30, 2003 (edited) Dumb question here...what's a "bump"? ...and by the way...the links that are on the above posted parent.php do not work yet. I am aware of this. I'm only in the beginning stages of my site rebuild. Edited May 30, 2003 by natimage Quote
surefire Posted May 30, 2003 Posted May 30, 2003 Natimage, You've come a long way with the php... congrats! I don't use much javascript, but I would seriously doubt that the php would be interfering with it in any way. If someone knows differently, please step in and correct me. The page did take a while to load when I pulled it up. I'm on a dial up. I'm not sure if it's the images, my ISP, or what. I serious doubt that it's the php that's slowing it down. I also noticed that with the rollovers, they worked, but only when the cursor was over certain parts of the picture. I'm guessing that the javascript needs tweaking since it's responsible for the rollover effect. Anyhow, sorry I can't tell you what is slowing up the page, but it could be many things. Currently, the sites I have at TCH aren't slowed down at all by php includes... But I'm in the process of transfering a 7000 page database driven website that's full of php and mysql code. If anything is going to slow down, it's a site like that... I'll let you know. I'm optimistically expecting TCH's servers to perform like a champ. I've taken this one step at a time by gradually moving sites over to TCH before attempting this huge move for my "baby." So far, everything has gone great. Dumb question here...what's a "bump"? Brings a 'dead' topic back to life so others see it and might respond to it. Bill was pointing out that the topic wasn't dead... I was just impatient and my subtraction was flawed when I thought several hours had passed. Quote
natimage Posted May 30, 2003 Posted May 30, 2003 Thanks for the clarification on the "bump", Jack! And thanks for the congrats. I was walking on cloud 9 yesterday just because of the success. I'm still waiting on that blasted book, though. No, I don't really think it is the php slowing things down. But, it almost seems that I've lost my preload function, which seems to work fine on this page: www.naturalimagesweb.com/parent.dwt, which is the same page that I literally copied and pasted code from to make my "php templates". I don't know anything about javascript coding either...just that it looks really complicated if you don't know anything about it. Tracy Quote
natimage Posted May 30, 2003 Posted May 30, 2003 (edited) Sorry...that link above is not working...I am trying to fix it... ...what a bone head I am sometimes! The correct link is www.naturalimagesweb.com/Templates/parent.dwt. You know what...I have the same errors on this page and didn't know it. So...excuse all of this from me. I still need some help I guess with the javascript...but I'm supposing that I should've started my own thread. My apologies, Tracy Edited May 30, 2003 by natimage Quote
TCH-JimE Posted May 30, 2003 Posted May 30, 2003 Nat, Can you provide a page which has this feature working and does not use php includes? I would like to compare the javascript if possible Thanks Jim Quote
natimage Posted May 30, 2003 Posted May 30, 2003 Hi, Jim. Unfortunately, I don't have another exact page like that with working java. The pages posted are part of a future site update that I'm just beginning. I do have a different page with rollover buttons that were also created in Fireworks. I was trying to figure out this morning if I could compare the two...but then I started having trouble with my Flash movie opening up. Anyway, what I've figured out this morning (I think) is that my rollovers are not preloading...yet I think I have code for this in the java?!?! Here are the pages I was trying to compare: www.naturalimagesweb.com/parent.php and www.naturalimagesweb.com/gallery.htm. I have not yet been able to verify that there are no errors on the gallery page, but I don't think there are. Let me know if you also have trouble with the flash movie. Also...the template file that I used to create parent.php opens as code in Netscape and Mozilla. Why in the world does it do this??? The url is www.naturalimagesweb.com/Templates/parent.dwt Thanks, Tracy Quote
surefire Posted May 30, 2003 Posted May 30, 2003 Natimage, Also...the template file that I used to create parent.php opens as code in Netscape and Mozilla. Why in the world does it do this??? The url is www.naturalimagesweb.com/Templates/parent.dwt Just a guess... but maybe the dwt ending. I'm not familiar with it but I assume it means, dreamweaver template also, I couldn't get your flash movie to open. Quote
TCH-Andy Posted May 30, 2003 Posted May 30, 2003 Yes, .dwt is a dreamweaver template file, so you should really creat a new page from the template file in dreamweaver, that will create a html page that you can use. The .dwt file has a few extra bits in it, but it should still work. I would change the extension to htm though Andy Quote
natimage Posted May 30, 2003 Posted May 30, 2003 Thanks guys...yes, it's a Dreamweaver template, and it is not a page that I intend to use. It's just where I got all the code for my new parent.php file. I just didn't know that it would come up as code because I had been using IE to preview my layout. As long as it is just because it's a template...I don't care!!! Don't know about the Flash movie...guess I need to re-upload it. Haven't done any work on it, so I'm not sure what could have caused the sudden problem. But, thanks for checking it for me! Tracy Quote
baseline Posted June 2, 2003 Author Posted June 2, 2003 sorry, i'm actually on trip right now so i don't have my code handy. i'll post live links when i get back basically when u have a basic PHP file and you use the include function to call some code from xxx.php, it'll load slower or it won't load at all. again, i'll post some live links when i get back, with and without the inclusion. oh, here's the error message i would get when it fails. user = domain, username = tch user name >Warning: main() [function.main]: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /home/username/public_html/index.php on line 27 Warning: main(http://user.com/header.php) [function.main]: failed to create stream: Resource temporarily unavailable in /home/username/public_html/index.php on line 27 Warning: main() [function.main]: Failed opening 'http://user.com/header.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/username/public_html/index.php on line 27 Quote
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.