Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS How to do this

  • This topic is empty.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #29835
    JimKueneman
    Member

    Not sure if this is the right place but since I am using a css template so far I may as well start here.

    Can someone give me a tip/hint how to do this. I have this

    http://www.mustangpeak.net/New_Website/index.html

    Now I want all pages to look the same except the "center panel" where the content of the page will be different. How can I do this in a way where there is a master page and I just write the html for the center panel?

    I am literate in software not html/java/css/ect so I will need much help if this gets too complicated.

    Thanks for any help.

    Jim

    #80332
    doobie
    Member

    You’ll definitely want to use PHP. Basically, you setup the common pieces of the site in PHP files. Then, include each piece on your new page…

    1 file might be "header.php" and include something like:

    <!DOCTYPE html>
    <head>
    <title>My new haircut</title>
    </head>
    <body>
    <div id="page-wrap">
    <nav>
    <!– your nav would go here –>
    </nav>

    Then, you might have "footer.php" :

    <footer>
    maybe your copyright would go here…
    </footer>

    </div><!– end page-wrap–>
    </body>

    You might also have a "sidebar.php", or whatever else.

    Then on each page you create, you just include each file in the appropriate place: "page1.php"

    <?php include(‘header.php’); ?>
    <h1>Page 1</h1>
    <section>
    <article> maybe an article goes here</article>
    </section>

    <?php include(‘sidebar.php’); ?>
    <?php include(‘footer.php’); ?>

    Of course, your server will have to be running php. If you want to develop it locally, run MAMP or WAMP or LAMP or XAMP, depending on your OS.

    Make sense?

    #80898
    JimKueneman
    Member

    I was afraid of that. I can fake my way through html, and muddle through css but php is a whole new adventure I am not sure I want to take right now. Maybe I should use Delphi for PHP? ;)

    Jim

    #80954
    virtual
    Participant

    No that’s not what he meant, you’re not actually writing any php, just using the php includes. Using php includes is easy. Read this http://www.tutorialtastic.co.uk/tutorial/php_includes or Google for Php include.

    The advantage of using the php include is that if you have 100 pages and need to change something in the navigation for example, you don’t have to update 100 pages, just the one file which contains the element you need to change. The downside is that to test locally you have to use MAMP or WAMP or XAMP depending on your platform, but you can also just upload the file and test it live.

    #80992
    doobie
    Member
    "virtual" wrote:
    No that’s not what he meant, you’re not actually writing any php, just using the php includes. Using php includes is easy. Read this http://www.tutorialtastic.co.uk/tutorial/php_includes or Google for Php include.

    The advantage of using the php include is that if you have 100 pages and need to change something in the navigation for example, you don’t have to update 100 pages, just the one file which contains the element you need to change. The downside is that to test locally you have to use MAMP or WAMP or XAMP depending on your platform, but you can also just upload the file and test it live.

    Thanks for the backup ;-)

    #81011
    JimKueneman
    Member

    Ah, I get it. Thanks.

    1) Ok this work locally but not when I upload it…..

    http://www.mustangpeak.net/New_Website/index.php

    any thoughts?

    2) Any pointer on how to make the content align to the right of the sidebar? Can I do this with CSS?

    Thanks,
    Jim

    #81004
    virtual
    Participant

    Write your include code like this:
    <?php include(‘header.php’); ?>

    Make sure your include files are in the same root as the index.php

    #81097
    JimKueneman
    Member

    Perfect. After a few days of reading and relearning my CSS stuff I have it working. Thanks to both of you. I have been trying to use modern techniques to update the website for a couple of year now and kept giving up.

    Looks pretty good for someone who doesn’t know what he is doing :lol:

    http://www.mustangpeak.net/New_Website/index.php

    compared to

    http://www.mustangpeak.net :oops:

    Jim

Viewing 8 posts - 1 through 8 (of 8 total)
  • The forum ‘CSS’ is closed to new topics and replies.