1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Best practices for creating a template...

Discussion in 'HTML & Website Design' started by Darwyn, Mar 17, 2010.

  1. #1
    This has been posted in the CSS forum, but perhaps that was not the appropriate place for it, so here it is again...


    Using CSS and div tags, I've created the main page for a site I am working on. I now need to create sub pages based on this main page (same header and footer).

    What is the best way to do this?

    I've used Dreamweaver as my html editor and can save the file as a .dwt file and insert editable regions. But is that the best way?

    or is it using a <?php include (contact.html) ?> function?

    Are there other ways?
    Darwyn, Mar 17, 2010 IP
  2. harrierdh

    harrierdh Peon

    Likes Received:
    Best Answers:
    Trophy Points:
    I have used this in the past.

    Create a file called contactInfo.js and put this code in it.

    var myContactInfo = "<p>MyName</p><p>MyPhone</p><p>MyEmail</p>";
    document.getElementById("contactInfo").innerHTML = myContactInfo;

    Create a file called contactInfo.html and put this code in it.

    <div id="footer">
    <div id="nav-contactInfo"></div>
    <script language="JavaScript" src="contactInfo.js"></script>

    Bring up the html file in your browser.

    So basically using Javascript you can create a client side include to store global information for all your pages.
    harrierdh, Mar 17, 2010 IP
  3. dannyvalentino

    dannyvalentino Peon

    Likes Received:
    Best Answers:
    Trophy Points:
    I would create a DWT as you will not need a knowledge of javascript...
    dannyvalentino, Mar 17, 2010 IP
  4. deathshadow

    deathshadow Acclaimed Member

    Likes Received:
    Best Answers:
    Trophy Points:
    the moment Dreamweaver is involved it's NEVER the best way - since not only are all the code examples they have decade or more out of date, and not only is the WYSIWYG side total trash, the comments they use to mark your insertable regions can trip rendering errors in IE. (YES, I SAID COMMENTS can trip rendering errors in IE)

    Step one, do yourself a HUGE favor and toss that buggy bloated mess of Adobe crap in the trash, and go get yourself a flat text editor like Notepad++, EditPlus or Crimson editor.

    Step two, go with the php includes. It's more versatile, and starts you on the path of being able to do even more powerful site building.
    deathshadow, Mar 19, 2010 IP