Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Problems with PHP 'include'

  • This topic is empty.
Viewing 4 posts - 16 through 19 (of 19 total)
  • Author
    Posts
  • #174199
    Anonymous
    Inactive

    I think you’ve missed what I was saying about paths to files on a PC and paths to a file, or folder, on a remote server. C:/user/JohnQPublic/desktop/public.doc is a path to a file on a PC and http://www.JohnQPublic/documents/public.html is a path to a file on a remote server. Both can be made to be Absolute or Relative. I read about this from several sources including this one which states

    A relative URL (defined in [RFC1808]) doesn’t contain any protocol or machine information. Its path generally refers to a resource on the same machine as the current document. Relative URLs may contain relative path components (“..” means one level up in the hierarchy defined by the path), and may contain fragment identifiers.

    Unless I’m not reading this correctly it seems that a path is a path but only different when dealing with a path to a file on a PC or a path to a file on a remote server.

    Regarding the contents of my contact page,; Yes, you understand what I am wanting to do. I’m wanting to put the cform within the <div id="form"> on the page here, and the current version of the form page is here. The source code is viewable for both, but if you want something else let me know. I’m not sure what you mean by > If you show me the contents of your index page

    I really appreciate this as I am sure I can use this to place the menu bar and the area containing the social icons on the pages as well. As these are universal to 98% 0f the pages which will be on the new site, it will be a lot easier making changes to one menu bar and one social icon area and have the changes automatically be on every pages instead of having to go through and change every page individually.

    Best Regards.

    #174256
    __
    Participant

    I’m not sure what you mean by > If you show me the contents of your index page

    Yesterday I clicked on the link to your index page and got a 404, so I asked. Maybe I clicked on the wrong thing. Go to our original thread for how to use the contact form class on your index page.

    C:/user/JohnQPublic/desktop/public.doc is a path to a file on a PC and http://www.JohnQPublic/documents/public.html is a path to a file on a remote server. Both can be made to be Absolute or Relative.

    Yes, both can be absolute or relative (though with URLs, this is only true because browsers implicitly add the protocol, domain, and/or base path if they are omitted).

    And yes, a URL is conceptually a path to a file on a remote server, and is often described that way, but it is not literally so. This is further confused because the part of a URL that looks like a filesystem path is also called a “path.”

    Think of it like a physical address: most times, 123 main street is the actual building a letter goes to. But sometimes, it’s a forwarding address and the actually letter goes elsewhere. Sometimes it’s a P.O. Box and the letter waits for someone to check in on it. Sometimes, there’s a secret agent working in the post office that sees “123 main street” and pulls the letter before it even gets into town.

    …actually, better “physical address” analogy:

    A URL is like a building’s name.
    A filesystem path is like directions to the building.

    Most buildings are simply “named” based on their directions (e.g., 123 Main st.). But they could have other names: “Main Street Hotel” or “Grand Hotel”.

    Unless I’m not reading this correctly it seems that a path is a path but only different when dealing with a path to a file on a PC or a path to a file on a remote server.

    This is an oversimplification – one that is very common, both because it is easy to understand, and because it’s usually “good enough” to get things working. It’s not strictly “wrong,” in that sense, but it leaves out the technical details that sometimes have an impact on programmer’s lives.

    In any case, I’m honestly not trying to complicate things any further. Like I said, in most cases, the “path” portion of a URL is used literally as a filesystem path (relative to the server’s document root). I think the whole problem can be simplified to a bit of practical advice:

    • Don’t use URLs in include/require.
    • Many times —not always— you can turn a URL into a filesystem path by replacing http://example.com with $_SERVER['DOCUMENT_ROOT']. (This is basically what Apache does to map URLs to actual files, under normal circumstances.)

    I really appreciate this as I am sure I can use this to place the menu bar and the area containing the social icons on the pages as well.

    Yes, in fact that should go more smoothly (I imagine these items —menu bars, etc— are just html?). Think of it as copy+paste instructions. Remember that any page where you want to use include must be a .php file.

    #174263
    __
    Participant

    C:/user/JohnQPublic/desktop/public.doc

    Also, remember that most web servers run on Linux, not Windows, so the filesystem path doesn’t have a drive letter (absolute paths start with /).

    #174320
    Anonymous
    Inactive

    Greetings Traq,

    Ok, I understand where you’re coming from better. It’s difficult when some web site like the one I gave seemingly contradict what you read, or hear, someplace else.

    Appreciate the education!

    Best Regards.

Viewing 4 posts - 16 through 19 (of 19 total)
  • The forum ‘Back End’ is closed to new topics and replies.