dcsimg
www.webdeveloper.com
Results 1 to 6 of 6

Thread: Best method for changing pages?

  1. #1
    Join Date
    Nov 2014
    Posts
    1

    Best method for changing pages?

    I'm not a very experienced web developer (probably because i'm 15) and I've recently started designing a site to host all of my games on.

    What i'm curious to know is the best 'method' of changing web pages, while also keeping other html files on the same page. basically I have a navigation bar, and thats using nav.html, and nav.css. what I want to know how to do is create several pages, i.e. home,about, etc. and how to go to and from those pages while also keeping my nav.html and nav.css files in use. Thanks!

    Heres a codepen if youre interested in seeing my code:
    <p data-height="268" data-theme-id="0" data-slug-hash="dPywxE" data-default-tab="result" data-user="Doodayer" class='codepen'>See the Pen <a href='http://codepen.io/Doodayer/pen/dPywxE/'>dPywxE</a> by Derrek (<a href='http://codepen.io/Doodayer'>@Doodayer</a>) on <a href='http://codepen.io'>CodePen</a>.</p>
    <script async src="//assets.codepen.io/assets/embed/ei.js"></script>

  2. #2
    Join Date
    Mar 2012
    Posts
    3,848
    This is a common problem, particularly with larger sites. The best solution (afaik) is to use PHP include files. To do this you need to set up and use a local host. This enables you to run server-side scripts:

    1. Download and install Wampserver (if you are on a Windows workstation). Don't worry, it is all automated.

    2. Create an off-line copy of your site in the Wampserver home folder: E.g. C:\wamp\www\mysite\index.html etc...

    3. Rename the web pages to .php instead of .html. E.g. index.html becomes index.php.

    4. Copy the common elements from index.php to separate source files, e.g. header.php, navbar.php etc...

    5. Replace the header text in index.php with:

    <?php include 'header.php'; ?>

    6. Do the same for the navbar etc...

    7. Launch Wampserver - if it is not already running (there should be an icon for this on our desk top).

    8. Create a shortcut to the local copy of your web site (if not already done). E.g.

    Target: http://localhost/mysite/index.php

    9. Click on the shortcut. Your home page should appear in your default browser.

    If you have edited the source files correctly the site should look and behave exactly as it did before, only it is now much easier to write and maintain the site as common elements of the web pages are written and edited once, instead of on each web page.

  3. #3
    Join Date
    Nov 2014
    Posts
    12
    Quote Originally Posted by jedaisoul View Post
    This is a common problem, particularly with larger sites. The best solution (afaik) is to use PHP include files. To do this you need to set up and use a local host. This enables you to run server-side scripts:

    ...

    If you have edited the source files correctly the site should look and behave exactly as it did before, only it is now much easier to write and maintain the site as common elements of the web pages are written and edited once, instead of on each web page.
    Great
    Last edited by jedaisoul; 12-25-2014 at 04:30 AM.

  4. #4
    Join Date
    Dec 2014
    Posts
    7
    good information....thank you very much)

  5. #5
    Join Date
    Dec 2014
    Posts
    5
    Really very informative and useful post is this. i always search forums like this and finally i got it... thanks

    *** link removed by moderator - please do not spam this site ***
    Last edited by jedaisoul; 12-25-2014 at 04:29 AM.

  6. #6
    Join Date
    Dec 2014
    Location
    USA
    Posts
    1
    Thanks for sharing this post... its really very informative post..

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles