Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 3 of 3
  1. #1
    Junior Member
    Join Date
    Jun 2017
    Posts
    1
    Member #
    56900

    Including Nav bar to each page

    I've always used a PHP include to put my nav bar at the top of my pages. These days that doesn't seem to work as well since pages are stored in folders and don't follow the same file structures. Surely common practice doesn't require modifying every page when you decide to make a menu change.

    So.... How do you guys do it?
    Last edited by prosportal; Jun 28th, 2017 at 01:01 PM.

  2.  

  3. #2
    Senior Member Ronald Roe's Avatar
    Join Date
    Mar 2011
    Location
    Oklahoma City
    Posts
    3,141
    Member #
    27197
    Liked
    959 times
    Who's storing their pages in separate folders?

    If you're building a mostly static site that has some PHP sprinkled in, there's nothing wrong with using includes. If the file structure is a problem, reconfigure it so it makes sense and go back to using your includes.

    There are definitely new ways of doing things, with MVC and other similar patterns, and NodeJS, React, Angular, etc., but that doesn't mean you have to stop doing things in an older way that works for you. That said, be careful that your skills don't become obsolete, either. Web technology stacks are growing rapidly, and while older paradigms still work, you may find that jobs that require that knowledge have dried up.
    Ron Roe
    Web Developer
    "If every app were designed using the same design template, oh wait...Bootstrap."

  4. #3
    Junior Member
    Join Date
    Jun 2017
    Posts
    4
    Member #
    56932
    make a new file named navbar.php
    then put the navbar code into that navbar.php file....

    now in every other files include the following line :
    include 'navbar.php';


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 01:09 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com