How to add many pages to HTML site?

Discussion in 'HTML & Website Design' started by Blisslife, Sep 14, 2007.

  1. #1
    HI
    What's the fastest way to add pages to a static html website? If I am building a 100-page website using Nvu, how to effectively add page 85 and at the same time all other pages will have page 85 on it. Do I have to do it manually to every page? That would it a long time? Is there anyway around it? Pls advise! Thanks
     
    Blisslife, Sep 14, 2007 IP
  2. jDare

    jDare Guest

    Messages:
    218
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    That is one of the downsides to static web sites. :( Creating the new page would have to be all manual but adding that link on all your other pages (assuming they all have the same basic format) can be done with one click of a button. Many text editors out there will allow you to do a massive search and replace on multiple files. Just find where you want your new link, and place it on all your pages.

    To help keep the code down, you can create a php or even javascript headers, sidebars, and footers so that all changes to all pages in those areas are all controlled by one file. Your site is still static but uses "dynamic" sidebars and so forth.
     
    jDare, Sep 14, 2007 IP
  3. Blisslife

    Blisslife Peon

    Messages:
    228
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    That's what I'm saying... If I built page 10, I would need to manually add page 10 to page 1, page2, page 3..etc . What you said sounds like a good solution to me though I'm not sure what it is. How do I add this function? Where can I find info about this . Thanks
     
    Blisslife, Sep 14, 2007 IP
  4. Jamie18

    Jamie18 Peon

    Messages:
    201
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #4
    what you want to do is create a header or footer or whatever, a file containing all the links to all the pages and than include it in every page.

    this way, whenever you add a new page you just add the new link to the header file and it will show up on every page that includes the header.. etc..

    http://www.boutell.com/newfaq/creating/include.html this is a random page i just found dealing with server side includes
     
    Jamie18, Sep 14, 2007 IP
  5. litebulb1

    litebulb1 Peon

    Messages:
    151
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I use PHP include to edit all my links.
     
    litebulb1, Sep 14, 2007 IP
  6. GamerJuice

    GamerJuice Peon

    Messages:
    25
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Or use a php system such as were it outputs the links like:

    index.php?page=home

    All you need to do this is to add the following code to the content area in your index.php file. And then to create a new page you just need to create a document with JUST the content in it and call it "Pagename.php":

    Code:

                        <?php 
                            $page = $_GET['page'];
                            if($page){
                                $site = file_exists($page.'.php') ? $page.'.php' : 'error.php';
                            }
                            else{
                                $site = 'home.php'; // default site
                            }
                            include($site);
                        ?>
    PHP:
    So all the links, images and everything are in the index.php file and all content is in the pagename.php file.

    Note:
    home.php is the home page
    error.php is the error page (404 Not Found)

     
    GamerJuice, Sep 14, 2007 IP
  7. AstarothSolutions

    AstarothSolutions Peon

    Messages:
    2,680
    Likes Received:
    77
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Generally you would use a template system to do what you require and therefore the links etc all exist within a single file so after adding a new page you only have one page to update.

    PHP does this via includes or .Net will allow you to do it using the .Master file etc.

    Taken to the next level of cause is using a CMS system where the seperate page does not technically exist but are all run from a database so "adding a page" will simultaniously add the content of the new page and add the link to the template.
     
    AstarothSolutions, Sep 17, 2007 IP
  8. silveraden

    silveraden Banned

    Messages:
    3,833
    Likes Received:
    109
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Create a template and do it manually... copy/paste the template and rename for every page and edit the content... no software could do this fast if it is on static html pages...
     
    silveraden, Sep 17, 2007 IP
  9. AstarothSolutions

    AstarothSolutions Peon

    Messages:
    2,680
    Likes Received:
    77
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Wouldnt do Silveraden's suggestion as this means that if you ever change your template you have to change every single page where as other's suggestions keeps the template and content seperate so changing the template for the whole site requires only one file to be changed.
     
    AstarothSolutions, Sep 18, 2007 IP
  10. krt

    krt Well-Known Member

    Messages:
    829
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    120
    #10
    Use a program with "Find/replace in all files"

    Find:
    <a href="page84.htm">Page 84</a>

    Replace with:
    <a href="page84.htm">Page 84</a>
    <a href="page85.htm">Page 85</a>

    Change as necessary.

    :D

    Seriously though, you should use server side scripting as everyone has been suggesting. The above technique could also be useful to replacing your static menu with a call to the include file, e.g. <?php include 'menu.php'; ?>

    Still far from an ideal system but should be fine for your needs.
     
    krt, Sep 18, 2007 IP