Header and Footer

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

    Header and Footer

    Hello,

    How can I put header.php and footer.php in my web pages?

    In my header I have a general Menu, and the footer has something
    similar to a | mini | web | map |.


    As a library, so when I modify header.php this changes in all the pages
    which contain both php, and it's not necessary to make changes
    individually.



    Thanks,
    J.A.

  • Chris Hope

    #2
    Re: Header and Footer

    J.A. wrote:
    [color=blue]
    > How can I put header.php and footer.php in my web pages?
    >
    > In my header I have a general Menu, and the footer has something
    > similar to a | mini | web | map |.
    >
    > As a library, so when I modify header.php this changes in all the
    > pages which contain both php, and it's not necessary to make changes
    > individually.[/color]

    <?php

    include('header .php');

    ....

    include('footer .php');

    ?>

    Manual page here: http://www.php.net/include
    You can also use require: http://www.php.net/require

    --
    Chris Hope | www.electrictoolbox.com | www.linuxcdmall.com

    Comment

    • J.A.

      #3
      Re: Header and Footer

      Ok, thanks Chris.

      2nd and last question (same issue):
      I have a stats code like this (stats.php):

      <?php
      <!-- Start of StatCounter Code -->
      <script type="text/javascript" language="javas cript">
      var sc_project=6134 25;
      var sc_partition=2;
      var sc_security="37 9fd115";
      </script>
      <script type="text/javascript" language="javas cript"
      src="http://www.statcounter .com/counter/counter.js"></script><noscrip t><a
      href="http://www.statcounter .com/" target="_blank" ><img
      src="http://c4.statcounter. com/counter.php?sc_ project=613425& amp;java=0&amp; security=379fd1 15"
      alt="free page hit counter" border="0"></a>
      </noscript>
      <!-- End of StatCounter Code -->
      ?>

      It´s okey stats.php?


      And can I include with this:
      include('./common/stats.php');



      Note: It´s the same code for all pages.
      Regards,
      J.A.

      Comment

      • Chris Hope

        #4
        Re: Header and Footer

        J.A. wrote:
        [color=blue]
        > Ok, thanks Chris.
        >
        > 2nd and last question (same issue):
        > I have a stats code like this (stats.php):
        >
        > <?php
        > <!-- Start of StatCounter Code -->
        > <script type="text/javascript" language="javas cript">
        > var sc_project=6134 25;
        > var sc_partition=2;
        > var sc_security="37 9fd115";
        > </script>
        > <script type="text/javascript" language="javas cript"
        >[/color]
        src="http://www.statcounter .com/counter/counter.js"></script><noscrip t><a[color=blue]
        > href="http://www.statcounter .com/" target="_blank" ><img
        >[/color]
        src="http://c4.statcounter. com/counter.php?sc_ project=613425& amp;java=0&amp; security=379fd1 15"[color=blue]
        > alt="free page hit counter" border="0"></a>
        > </noscript>
        > <!-- End of StatCounter Code -->
        > ?>
        >
        > It´s okey stats.php?[/color]

        Yes, but don't put the <?php and ?> at the start and end of your include
        file otherwise you'll get parse errors. What you have is straight
        HTML/Javascript so there's no need for them.
        [color=blue]
        > And can I include with this:
        > include('./common/stats.php');[/color]

        That's correct, assuming the script you are calling it from is in the ./
        directory.

        --
        Chris Hope | www.electrictoolbox.com | www.linuxcdmall.com

        Comment

        • J.A.

          #5
          Re: Header and Footer

          Ok, thank you


          J.A.

          Comment

          Working...