Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: locating to files

  1. #1
    Join Date
    Nov 2007
    Posts
    346
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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.

  2. #2
    Join Date
    Jan 2007
    Posts
    629
    Thanks
    10
    Thanked 28 Times in 28 Posts

    Default

    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.
    --Jas
    function GreatMinds(){ return "Think Like Jas"; }
    I'm gone for a while, but in the meantime: Try using my FTP script | Fight Bot Form Submissions

  3. #3
    Join Date
    Nov 2007
    Posts
    346
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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!

  4. #4
    Join Date
    Jan 2007
    Posts
    629
    Thanks
    10
    Thanked 28 Times in 28 Posts

    Default

    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:
    Code:
    <?php $var = 1; ?>
    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.
    Last edited by Jas; 03-03-2008 at 03:44 AM.
    --Jas
    function GreatMinds(){ return "Think Like Jas"; }
    I'm gone for a while, but in the meantime: Try using my FTP script | Fight Bot Form Submissions

  5. #5
    Join Date
    Nov 2007
    Posts
    346
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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!

  6. #6
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    Use PHP templates.
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

  7. #7
    Join Date
    Nov 2007
    Posts
    346
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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!

  8. #8
    Join Date
    Jan 2007
    Posts
    629
    Thanks
    10
    Thanked 28 Times in 28 Posts

    Default

    Tech_support: You should be a little more discriptive in posts. (although I get the feeling you've been down this road before )

    afe: Try looking through this tutorial, incidently by Tech_support.
    --Jas
    function GreatMinds(){ return "Think Like Jas"; }
    I'm gone for a while, but in the meantime: Try using my FTP script | Fight Bot Form Submissions

  9. #9
    Join Date
    Nov 2007
    Posts
    346
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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!

  10. #10
    Join Date
    Jan 2007
    Posts
    629
    Thanks
    10
    Thanked 28 Times in 28 Posts

    Default

    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.)
    --Jas
    function GreatMinds(){ return "Think Like Jas"; }
    I'm gone for a while, but in the meantime: Try using my FTP script | Fight Bot Form Submissions

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •