-
locating to files
Ok, here is my situation. I need to link to a file under public_html/soccer that is called header.php, however, I am in a file in public_html/running that is called index.php.
public_html >soccer> header.php
running> index.php
How do I link to header.php with this code? <?php include (' ') ?>
Thank you very much.
-
Okay, are you saying that the folder is not in your site, or that it is in a previous directory? If the latter, use:
PHP Code:
include('www.mysite.com/public_html/soccer/header.php')
//or
include('../public_html/soccer/header.php')
If it is not part of your site, you need to make an alias so that APACHE (if that's your server) includes the folder to your website. You decide what the url to that folder is, for example:
Code:
www.mysite.com/alias/
The best/easiest way to create an alias depends on your OS and server.
-
The site is mine. I think I now understand why it did not work. I used <?php include ('www.mysite.com/soccer/header.php') and all I got was an empty page on the running/index.php. I did not put the public_html. I tried it but it still did not work with the full URL.
Can you tell me why it's not working?
Thanks!
-
Where is your root directory? In other words, what folder is www.mysite.com contained in? I just want to make sure that it's not public_html, because that would mean the path should not include that folder. Also, is the path from that folder to the file 'www.mysite.com/public_html/soccer/header.php' ?
And finally, make sure that the file being included prints something. A file like this:
will show up as blank, because it doesn't echo anything.
Edit: To clarify the first question: C:/wamp/www/public_html/. . . .
Which folder is the root web folder? I am asuming that the site is www, and everything above it is inside your website. So,
C:/wamp/www/ = www.mysite.com
not C:/wamp/www/public_html = www.mysite.com
I hope that made sense. The folders are not really how they are on your server, I'm sure, it's just an example.
-
Yes it is just an example. The page that I am working on is http://afesports.com/indexxxxx.php and I'm trying to locate to includes/header.php. I want to use the full URL because I will have folders for each sport. Such as /soccer and with the same design, so I wanted to know how to link it.
Thanks!
-
-
You tell me that on every post! But, I just don't know how to make one and would really love to make one. Your PHP Template Tutorial is awsome, however, it's like written in a language that is impossible to understand!
Can you please get me a template going with that layout? http://www.afesports.com/indexxxxx.php
Thanks!
-
Tech_support: You should be a little more discriptive in posts. (although I get the feeling you've been down this road before :p)
afe: Try looking through this tutorial, incidently by Tech_support.
-
Yeah, I have seen that post. However, I cannot understand it. Also, can you please tell me why I am getting this error "
Warning: main(http://www.afesports.com/public_html...des/header.php) [function.main]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/afesport/public_html/indexxxxx.php on line 49" on this page http://afesports.com/indexxxxx.php when I try to link to includes/header.php . Please help and thanks!
-
Ah! A link to the site. I don't know why, but I thought the site was offline (even with a link in another of your posts-- I'm a bit slow it seems). In any case, with that additional tid-bit, I think I've got it. The URL should be:
http://www.afesports.com/includes/header.php
The error is saying that the file could not be found.
(Public_html is your document root, so it should not be in the url.)