Loading ...
Sorry, an error occurred while loading the content.
 

Re: [NH] Need help with path for PHP incude

Expand Messages
  • Mike Breiding - Morgantown WV
    Rudi, Thanks for your elaboration and details below. But, I admit it strained my pea sized brain! -Mike ====================
    Message 1 of 25 , Mar 7, 2012
      Rudi,
      Thanks for your elaboration and details below.
      But, I admit it strained my pea sized brain!
      -Mike
      ====================

      On 3/6/2012 11:57 PM, rhorbas@... wrote:
      > Mike Breiding wrote:
      >> On 3/6/2012 5:01 PM, rhorbas@... wrote:
      >>> Mike Breiding - Morgantown WV schrieb am 07.03.2012 00:54:
      >>>> On 3/6/2012 4:42 PM, Rudolf Horbas wrote:
      >>>>> <?php include $_SERVER['DOCUMENT_ROOT'] .
      >>>>> '/2011/mtown2gv_nov_2011_p1/w1navigation.php'; ?>
      >>>>> should do it. HTH, Rudi
      >>
      >>>> That did it!
      >>> Great!
      >>>
      >>>> Have you any input on the use of a specific path:
      >>>> http://epicroadtrips.us/2011/mtown2gv_nov_2011_p1/w1navigation.php
      >>>
      >>> What exactly do you mean?
      >>
      >> You answered that here:
      >>
      >>> Yes, you can. Not only will this fail in certain configs
      >>> (allow_url_fopen, allow_url_include): There's no point using a slow http
      >>> request via the network when the file is on the same disk.
      >>> Use an absolute path instead, and prepend it with the server var
      >>> DOCUMENT_ROOT:
      >>>
      >>> <?php
      >>> include $_SERVER['DOCUMENT_ROOT'] .
      >>> '/2011/mtown2gv_nov_2011_p1/w1navigation.php';
      >>> ?>
      >
      > That's basically the same -- I'm just elaborating on this specific
      > method of inclusion, because it's rather failsafe.
      >
      > Inclusion of files via http is definitely slower and completely
      > unnecessary here, because php is allowed to get the file via it's own
      > disk system.
      > Getting the file via http has other disadvantages: It's being processed
      > by php first, so any *php* code in the file is not available to the
      > files including it, unless it generates php code itself, which would be
      > really awkward.
      > In other contexts, where you don't have complete control over the
      > included file's contents, it's even a dangerous idea: Any generated php
      > code in the file is being executed in the server's context, so it would
      > be easy to insert malicious code. That's why many server configurations
      > will have disabled it by default.
      >
      > So in a nutshell:
      >
      > Never use this method, unless you have very specific reasons to do so.
      >
      > Relative paths ("../../path/to/include.php") will get you there, albeit
      > it takes some experience to find the correct path.
      >
      > Absolute paths with the server's document root (that's where the files
      > are stored that are accessible via a browser) as a variable will almost
      > always work.
      >
      > Rudi
      >
      >
      > ------------------------------------
    • Mike Breiding - Morgantown WV
      I m back again with the same need but a different situation. I want to use an include within and include. I would like to use a master menu as an include for
      Message 2 of 25 , Jul 28, 2012
        I'm back again with the same need but a different situation.

        I want to use an include within and include.

        I would like to use a master menu as an include for each of my pages.
        The master is here:
        http://epicroadtrips.us/master_menu.php

        I want to use the master include in this include:
        <div id="navwrapper">
        <div id="navigation">
        <?php include("w1navigation.php"); ?>
        </div>
        </div>

        This would be the file w1navigation.php with the "master_menu.php" include.
        I am hoping for this result for each page menu:
        http://epicroadtrips.us/2012/escape/
        The above link uses a copy and paste to include the master menu.


        ~~~~~~~~w1navigation.php~~~~~~~~~
        <h4>Mike Breiding's Epic Road Trips<br /> Spain: 10 Days in Segovia</h4>

        <ul>
        <li class="week">Week 1</li>
        <li<?php if ($thisPage=="day1-03september2010") echo "
        id=\"currentpage\""; ?>><a href='http://epicroadtrips.us/2010/spain/d1/'
        title="Day 1: My First Flight East - Pittsburgh, DC, Madrid,
        Segovia">Day 1: My First Flight East - Pittsburgh, DC, Madrid,
        Segovia</a></li>

        <?php include("master_menu.php"); ?>

        li style="font-size: 100%; margin-left: 15px; margin-top:
        15px"><strong><a href="http://EpicRoadTrips.us" target="_blank"
        title="Mike Breiding's Epic Road Trips">
        ERT - HOME</a></strong></li>
        </ul>

        <div id="dedication">
        <p><a href='http://EpicRoadTrips.us/dad' target="_blank" title=" My
        dad's web site ">This site is dedicated to my father:<br />
        <strong style="font-size:105%">George H. Breiding</strong><br />
        Read more...</a></p>
        ~~~~~~~~~~~~~~~~~

        The question is the same as before.
        How to direct each current page menu to the same master_menu.php file so
        it is added to the current page menu.

        I am not sure this is clear or not.

        Thanks,
        -Mike




        On 3/6/2012 6:49 PM, Rudolf Horbas wrote:
        > Mick Housel wrote:
        >
        >> include("http://epicroadtrips.us/2011/mtown2gv_nov_2011_p1/w1navigation.php");
        >> (long line above)
        >>
        >> You can't get any more straightforward than completely defining the
        >> path, my preference.
        >
        > Yes, you can. Not only will this fail in certain configs
        > (allow_url_fopen, allow_url_include): There's no point using a slow http
        > request via the network when the file is on the same disk.
        > Use an absolute path instead, and prepend it with the server var
        > DOCUMENT_ROOT:
        >
        > <?php
        > include $_SERVER['DOCUMENT_ROOT'] .
        > '/2011/mtown2gv_nov_2011_p1/w1navigation.php';
        > ?>
        >
        > Rudi
        >
        >
        > ------------------------------------
        >
        > Fookes Software: http://www.fookes.com/
        > NoteTab website: http://www.notetab.com/
        > NoteTab Discussion Lists: http://www.notetab.com/groups.php
        >
        > ***
        > Yahoo! Groups Links
        >
        >
        >
        >
        >
      • John Shotsky
        I ve never tried that, but if not supported, I would break the master include into two parts, then call the first one, then the sub include, then the second
        Message 3 of 25 , Jul 28, 2012
          I've never tried that, but if not supported, I would break the master include into two parts, then call the first one,
          then the 'sub' include, then the second part of the master include.

          Regards,
          John
          RecipeTools Web Site: http://recipetools.gotdns.com/


          -----Original Message-----
          From: ntb-html@yahoogroups.com [mailto:ntb-html@yahoogroups.com] On Behalf Of Mike Breiding - Morgantown WV
          Sent: Saturday, July 28, 2012 10:05
          To: ntb-html@yahoogroups.com
          Cc: Rudolf Horbas
          Subject: Re: [NH] Need help with path for PHP incude

          I'm back again with the same need but a different situation.

          I want to use an include within and include.

          I would like to use a master menu as an include for each of my pages.
          The master is here:
          http://epicroadtrips.us/master_menu.php

          I want to use the master include in this include:
          <div id="navwrapper">
          <div id="navigation">
          <?php include("w1navigation.php"); ?>
          </div>
          </div>

          This would be the file w1navigation.php with the "master_menu.php" include.
          I am hoping for this result for each page menu:
          http://epicroadtrips.us/2012/escape/
          The above link uses a copy and paste to include the master menu.


          ~~~~~~~~w1navigation.php~~~~~~~~~
          <h4>Mike Breiding's Epic Road Trips<br /> Spain: 10 Days in Segovia</h4>

          <ul>
          <li class="week">Week 1</li>
          <li<?php if ($thisPage=="day1-03september2010") echo "
          id=\"currentpage\""; ?>><a href='http://epicroadtrips.us/2010/spain/d1/'
          title="Day 1: My First Flight East - Pittsburgh, DC, Madrid,
          Segovia">Day 1: My First Flight East - Pittsburgh, DC, Madrid,
          Segovia</a></li>

          <?php include("master_menu.php"); ?>

          li style="font-size: 100%; margin-left: 15px; margin-top:
          15px"><strong><a href="http://EpicRoadTrips.us" target="_blank"
          title="Mike Breiding's Epic Road Trips">
          ERT - HOME</a></strong></li>
          </ul>

          <div id="dedication">
          <p><a href='http://EpicRoadTrips.us/dad' target="_blank" title=" My
          dad's web site ">This site is dedicated to my father:<br />
          <strong style="font-size:105%">George H. Breiding</strong><br />
          Read more...</a></p>
          ~~~~~~~~~~~~~~~~~

          The question is the same as before.
          How to direct each current page menu to the same master_menu.php file so
          it is added to the current page menu.

          I am not sure this is clear or not.

          Thanks,
          -Mike




          On 3/6/2012 6:49 PM, Rudolf Horbas wrote:
          > Mick Housel wrote:
          >
          >> include("http://epicroadtrips.us/2011/mtown2gv_nov_2011_p1/w1navigation.php");
          >> (long line above)
          >>
          >> You can't get any more straightforward than completely defining the
          >> path, my preference.
          >
          > Yes, you can. Not only will this fail in certain configs
          > (allow_url_fopen, allow_url_include): There's no point using a slow http
          > request via the network when the file is on the same disk.
          > Use an absolute path instead, and prepend it with the server var
          > DOCUMENT_ROOT:
          >
          > <?php
          > include $_SERVER['DOCUMENT_ROOT'] .
          > '/2011/mtown2gv_nov_2011_p1/w1navigation.php';
          > ?>
          >
          > Rudi
          >
          >
          > ------------------------------------
          >
          > Fookes Software: http://www.fookes.com/
          > NoteTab website: http://www.notetab.com/
          > NoteTab Discussion Lists: http://www.notetab.com/groups.php
          >
          > ***
          > Yahoo! Groups Links
          >
          >
          >
          >
          >


          ------------------------------------

          Fookes Software: http://www.fookes.com/
          NoteTab website: http://www.notetab.com/
          NoteTab Discussion Lists: http://www.notetab.com/groups.php

          ***
          Yahoo! Groups Links
        • Mike Breiding - Morgantown WV
          ... Hi John, My main brain twister is how to point all the pages to one include file. In other words - figuring out the path to use for each one. If the
          Message 4 of 25 , Jul 28, 2012
            On 7/28/2012 1:21 PM, John Shotsky wrote:
            > I've never tried that, but if not supported, I would break the master include into two parts, then call the first one,
            > then the 'sub' include, then the second part of the master include. Regards, John

            Hi John,
            My main brain twister is how to point all the pages to one include file.
            In other words - figuring out the path to use for each one.

            If the include within an include is not supported I think I can work
            with that. But the path question is my concern.

            Thanks,
            -Mike
          • Axel Berger
            ... Not sure if I ve got it, but could you write is as an absolute path beginning with a slash / to make it work from everywhere? Axel
            Message 5 of 25 , Jul 28, 2012
              Mike Breiding - Morgantown WV wrote:
              > But the path question is my concern.

              Not sure if I've got it, but could you write is as an absolute path
              beginning with a slash "/" to make it work from everywhere?

              Axel
            • Mike Breiding - Morgantown WV
              ... I will see what I can do with that. Thanks, -Mike
              Message 6 of 25 , Jul 29, 2012
                On 7/28/2012 7:22 PM, Axel Berger wrote:
                > Mike Breiding - Morgantown WV wrote:
                >> But the path question is my concern.
                >
                > Not sure if I've got it, but could you write is as an absolute path
                > beginning with a slash "/" to make it work from everywhere?

                I will see what I can do with that.
                Thanks,
                -Mike


                >
                > Axel
                >
                >
                > ------------------------------------
                >
                > Fookes Software: http://www.fookes.com/
                > NoteTab website: http://www.notetab.com/
                > NoteTab Discussion Lists: http://www.notetab.com/groups.php
                >
                > ***
                > Yahoo! Groups Links
                >
                >
                >
                >
                >
              • rhorbas@gmx.net
                the following is failsafe: $_SERVER[ DOCUMENT_ROOT ] . /path/to/your/include.php Rudi
                Message 7 of 25 , Jul 30, 2012
                  the following is failsafe:

                  $_SERVER['DOCUMENT_ROOT'] . '/path/to/your/include.php'

                  Rudi

                  Mike Breiding - Morgantown WV schrieb am 29.07.2012 14:58:
                  > On 7/28/2012 7:22 PM, Axel Berger wrote:
                  >> Mike Breiding - Morgantown WV wrote:
                  >>> But the path question is my concern.
                  >>
                  >> Not sure if I've got it, but could you write is as an absolute path
                  >> beginning with a slash "/" to make it work from everywhere?
                  >
                  > I will see what I can do with that.
                  > Thanks,
                  > -Mike
                  >
                  >
                  >>
                  >> Axel
                • Mike Breiding - Morgantown WV
                  ... Thanks. I will play with this. -Mike
                  Message 8 of 25 , Jul 30, 2012
                    On 7/30/2012 11:07 AM, rhorbas@... wrote:
                    > the following is failsafe:
                    >
                    > $_SERVER['DOCUMENT_ROOT'] . '/path/to/your/include.php'


                    Thanks.
                    I will play with this.
                    -Mike

                    >
                    > Rudi
                    >
                    > Mike Breiding - Morgantown WV schrieb am 29.07.2012 14:58:
                    >> On 7/28/2012 7:22 PM, Axel Berger wrote:
                    >>> Mike Breiding - Morgantown WV wrote:
                    >>>> But the path question is my concern.
                    >>>
                    >>> Not sure if I've got it, but could you write is as an absolute path
                    >>> beginning with a slash "/" to make it work from everywhere?
                    >>
                    >> I will see what I can do with that.
                    >> Thanks,
                    >> -Mike
                    >>
                    >>
                    >>>
                    >>> Axel
                  Your message has been successfully submitted and would be delivered to recipients shortly.