Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5

Thread: templates??

  1. #1
    Regular Coder
    Join Date
    Jun 2006
    Location
    Gainsborough
    Posts
    102
    Thanks
    0
    Thanked 0 Times in 0 Posts

    templates??

    Hi

    Each time i create a new part on my NAV Bars i need to copy and paste it throughout each individual page i create. Is PHP the answer to this?

    Can i have it so i only maintain a NAV BAR in one place and it to automatically update on all pages.

    Many thanks in advance for your help.

    Peter
    --
    Peter Potter
    PSP Wallpapers

  • #2
    Regular Coder
    Join Date
    Nov 2002
    Location
    Manchester, UK
    Posts
    533
    Thanks
    4
    Thanked 1 Time in 1 Post
    yup...

    create a page and save it as "nav_bar.php" (or what ever) and in each of your pages, where you want the bar to appear put

    <?php include "nav_bar.php"; ?>

    that way you only update on file which is included on all the pages.

  • #3
    New Coder
    Join Date
    Oct 2006
    Posts
    82
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Are you sure that works, I thought the brackets were mandatory and it should look like this...

    PHP Code:

    <?php

    include("nav_bar.php");

    ?>
    I would also name the included files you use .inc.php and put them all in an includes folder and refer to them as shown below. It's totally optional is a good way to organise files that have numerous dependancies.

    PHP Code:

    <?php

    include("includes/nav_bar.inc.php");

    ?>

  • #4
    Senior Coder
    Join Date
    Aug 2003
    Location
    One step ahead of you.
    Posts
    2,815
    Thanks
    0
    Thanked 3 Times in 3 Posts
    The brackets are not needed. include/require are not real functions.
    I'm not sure if this was any help, but I hope it didn't make you stupider.

    Experience is something you get just after you really need it.
    PHP Installation Guide Feedback welcome.

  • #5
    Regular Coder
    Join Date
    Jun 2006
    Location
    Gainsborough
    Posts
    102
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks a lot, i will give it a bash before i go on holiday!!
    --
    Peter Potter
    PSP Wallpapers


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •