Jump to content
Sign in to follow this  
natimage

Include Function Not Working

Recommended Posts

I hope this is the appropriate forum. I'm really tired this evening and not thinking very straight.

 

Earlier in the day, THIS SITE resolved fine. It had suffered from a DNS problem, but was working as of about 6 hours ago. I left home, went to the movies, came back home, installed a new fan on cpu, ate dinner, took nap...and now all of a sudden the header and footer will not pull into this site.

 

I haven't done anything to it all afternoon...so what in the world could be going on???

 

Help, please...begs a sleepy, groggy little reseller!!!

 

Here's my php code for the header:

 

><?php //get header file
include "http://www.pioneershospital.org/inc/PHhead.php";
?>

Share this post


Link to post
Share on other sites

well...that's odd. I'm cleaning my cache right now...maybe I was only seeing it by fluke.

 

Nope...cache cleaned and it is still coming up for me, just not with header and footer files.

Share this post


Link to post
Share on other sites

ok...maybe it's just my php stupidity shining through, but, if the primary domain for your site is .org...wouldn't that be the appropriate thing to use in any absolute url on your site?

 

I changed my php code to read .com instead of .org and now the includes are working. Why in the world would it matter? And why in the world did it work fine a few hours ago??

 

Please excuse my sounding a bit put out...I'm just tired and have had multiple problems with this particular site of the past couple of days! :goof:

Share this post


Link to post
Share on other sites

it should work with .org since that is the domain name, the reason it works with .com is because pioneershospital.com is parked on pioneershospital.org.

 

Sorry but thats about all the help I can offer, i'm useless with php

Share this post


Link to post
Share on other sites

Thanks for looking at it, Mike. I would agree with you. However, it sure didn't work this evening. Maybe it only works between certain hours of the day, which would explain why it worked BEFORE I went to the movies!! :goof: Seriously, I don't understand it. The only thing I changed in the php code was .org to .com. I didn't rewrite the rest of it or anything...

 

I'm clueless...but at least it's working for now!

Share this post


Link to post
Share on other sites

if you use

include $_SERVER['DOCUMENT_ROOT']."/inc/PHhead.php";

it will be portable and work from any place on your site

Share this post


Link to post
Share on other sites

Don...that is actually what I use on all my other sites. However, I think I remember having difficulty getting folders and sub-folders to call the include correctly using that format. Maybe it was just my lack of php knowledge causing problems. I'm re-coding most of this site, so I will give it another try.

 

Still...the problems I had yesterday don't make sense to me!!

Share this post


Link to post
Share on other sites

Tracy, you're using URLs with the include function, which may not wield the results you were expecting. Read my posts about that in this thread :lol:

Share this post


Link to post
Share on other sites

Okay, Raul...2 things.

 

1. How in the world did you get that thread link to go somewhere in the middle of the page instead of to the top of the page? It was like an anchor link or something...

 

2. Now the real question. If my site structure is

 

etc

mail

public_ftp

public_html

.....index.php

.....include folder

..........header.php

.....folder2

..........page1.php

 

 

Can I use the same include method in index.php, which is in public_html folder, as I use in page1.php, which is in a subfolder of the public_html folder?? Is it better to have my include folder at the same level as the public_html folder?

Share this post


Link to post
Share on other sites

Well...I guess I should say, "nevermind". I played with it a bit and it does work using the same path for files in the public_html directory and files in sub-directories. Maybe what I am remembering having problems with was getting the includes to work locally using phpdev. I had to use a different path because the root folder system was not setup the same.

 

Thanks for the information, Raul!!!

Share this post


Link to post
Share on other sites

Glad you got the second question answered, Tracy :)

 

About the first one, it's simple, each post has an anchor. You can see it in the code and add the appropriate "#postID" to the end of the URL or, even better, click the "Posted" link that appears above each post, just before the post date. It will open a JavaScript dialog containing a direct link to that post :)

Share this post


Link to post
Share on other sites

Gee...thanks, man!!! I never even payed attention to that posted link...much less clicked it! Very handy!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...