A direct url within an include

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Nancy

    A direct url within an include

    I am trying to put a direct url in this form <?php
    include("messag eboard.html"); ?> is it possible and what is the code?
    What I am trying to do is link to a footer that opens on all pages. Any
    help would be appreciated.

    Nancy

  • Janwillem Borleffs

    #2
    Re: A direct url within an include

    Nancy wrote:[color=blue]
    > I am trying to put a direct url in this form <?php
    > include("messag eboard.html"); ?> is it possible and what is the code?
    >[/color]

    It is possible and you've just given the code. Or do you experience problems
    when doing it like this?


    JW


    Comment

    • ahhbegypt@yahoo.com

      #3
      Re: A direct url within an include

      all u need is to make some HTML page and put in it any content for your
      footer then in any php page in your site at the end of your code add
      this code :-
      <?
      include("footer .htm");
      ?>
      and change footer.htm with the URL of your HTML page - if it is located
      in the same dir with all o fyour php files so put it in this form
      include("footer .php"); and if located at a remote server for example
      you can use this form include("http://yahoo.com/footer.htm"); only for
      example

      if you have any more problems - reply again

      Ahmed ,

      Comment

      • Nancy

        #4
        Re: A direct url within an include

        the footer is on the site but not in the same folder. We have tried the
        short link of footer.html and also http://mydomain.com/footer.html and
        neither has worked

        Comment

        • stevenowicki@gmail.com

          #5
          Re: A direct url within an include

          include('somefi le.ext') assumes that somefile.ext is in the same
          directory as the PHP file containing the include statement. If the
          included file is in another directory, for example the parent
          directory, then you need to call include('../somefile.ext'). Realizing
          that this can be something of a PITA when trying to include it in files
          that may be spread over multiple directories, my suggestion is to
          define a constant that points to the physical path to the application
          root, which would allow you to do something like the following:

          //in constants.php included into all page requests
          define('APP_ROO T', '/opt/websites/mysite/');

          //somewhere else in the application
          include(APP_ROO T . 'includes/somefile.ext');

          Comment

          Working...