Include command, PHP

Discussion in 'Computer Support' started by Steve Freides, Jan 18, 2004.

  1. I asked yesterday about including another web page in several of my pages as
    part of a redirection process. I wasn't clear - I know how to handle the
    redirection already.

    My ISP tells me they support php. Could some please provide an example of
    an include? In my case, I want page

    to include

    I actually do not need to include a web page - it's a block of text I need
    to include. Whatever will get me there will suffice. The included block of
    text will be the only visible item on page_1.htm and others like it.

    Hope I've explained better, and TIA.

    Steve Freides, Jan 18, 2004
    1. Advertisements

  2. Steve Freides

    why? Guest

    Do you really need to include the text for a redirection?
    If your ISPs webserver is Apache you can use the mod_rewrite

    This means any request like this (only 1 example)
    is transparently changed to

    or even
    can become
    as needed, this way visitors to the site only need know about 1 URL.
    Maybe include a file is what you mean?

    PHP newsgroups

    Find closest mirror for the documentation, tutorial , user groups


    why?, Jan 18, 2004
    1. Advertisements

  3. Steve Freides

    °Mike° Guest

    °Mike°, Jan 18, 2004
  4. Hywel Jenkins, Jan 18, 2004
  5. I looked at the link you provided, and added

    include "pagename.htm"

    into the body section of my page - it doesn't display. Using a fully
    qualified URL didn't help, neither did moving it above the start of the body

    Any ideas as to what I'm doing wrong? It doesn't give errors, just doesn't

    Steve Freides, Jan 18, 2004
  6. Steve Freides

    °Mike° Guest

    Did your read this part?

    "Be sure to have an appropriate include_path setting as well."

    include_path string

    Specifies a list of directories where the require(), include() and
    fopen_with_path() functions look for files. The format is like the
    system's PATH environment variable: a list of directories separated with
    a colon in Unix or semicolon in Windows.

    Example 4-3. Unix include_path

    Example 4-4. Windows include_path

    Using a . in the include path allows for relative includes as it means
    the current directory.

    °Mike°, Jan 18, 2004
  7. Is your server properly configured? Have you named the file correctly?
    What's in the source code when you view the page from your browser?
    Hywel Jenkins, Jan 18, 2004
  8. So, since the file is kept in the same place, and the server runs some
    flavor of *nix,

    include "pagename.htm"

    should make it work? I notice that the "=" isn't shown in all the examples,
    e.g., the heading just says include_path string.


    Steve Freides, Jan 18, 2004
  9. Steve Freides

    °Mike° Guest

    I'm not versed in php -- I'm just trying to point you in
    the right direction. I suggest you start reading; you
    missed the obvious from my first post.

    °Mike°, Jan 18, 2004
  10. With all due respect, Mike, I _did_ read, I'm not convinced that
    include_path is even necessary if the file to be included is in the same
    folder, and I would like to hear from someone who is familiar with php
    rather than someone who can perform a Google search. I'm perfectly capable
    of that myself.


    Steve Freides, Jan 18, 2004
  11. Is your server properly configured? Have you named the file correctly?
    What's in the source code when you view the page from your browser?

    My ISP and web hosting provider is Earthlink. They tell me they run Unix
    and support php. The source code, when viewed from a browser, is just as it
    was when I composed it. I'm using MS Front Page and working with the HTML
    directly. Here's the page - have a look for yourself - it times out in 5
    seconds now but that's enough time to open up the source code window.

    Steve Freides, Jan 18, 2004
  12. Steve Freides

    °Mike° Guest

    Obviously you're not, else you would have sorted your
    problem out by now. There are many webmaster
    forums out there, or even newsgroups. Try them.

    °Mike°, Jan 18, 2004
  13. Lose the include_path line, too, it shouldn't be in there, but should be
    your php.ini file - you won't be able to edit that.
    Hywel Jenkins, Jan 18, 2004
  14. Steve Freides

    why? Guest

    That's lucky then, I have seen FP alter/mangle HTML/scripting codes not
    generated by itself.
    Have you tried any more basic PHP like any of this?

    <? print ("Hello World"); ?>

    <? print date("H:i:s"); ?>

    or with HTML

    print "Hello World";

    why?, Jan 18, 2004
  15. Tried some simple php, nothing appeared on the screen, so I'll be calling
    the ISP's tech support tomorrow morning. I'll report back on what I find.

    Any chance that my IE 6 has a setting that doesn't allow php by default?

    Steve Freides, Jan 18, 2004
  16. Nope - PHP Commands are executed by the server, not the client. (GOHD!
    Can you imagine extra PHP commands for IE pre-5.5sp1, IE 5.5sp1, IE
    5.5sp2, IE 6.x, Mozilla pre-1.x, Mozilla 1.0, Mozilla 1.1 - 1.4, Mozilla
    1.5 + 1.6......)
    BuffNET Tech Support - MichaelJ, Jan 19, 2004
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.