site template -- script needed? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

site template -- script needed?

I want to create a template for my website to help give it a consistent look and feel. I'm not very experienced with html, and I have virtually no script experience, so this might be a dumb question that everyone but me knows the answer to.

My layout is organized into table cells like so:
------------------------------
| | header/graphic/ |
| filler | banner |
------------------------------
| | |
| links | content |
| | |
| | |
------------------------------

I want the template to fill the cells for 'filler', 'header/et.al', and 'links' from a separate file (*.txt or *.htm). I know to use image for any cells that include only images, but for other cells ... how do i pull in html from a different file?

Thanks,
-MW

Comments

  • aint2goodaint2good Posts: 7Member
    I don't want to use frames for this.

    : I want to create a template for my website to help give it a consistent look and feel. I'm not very experienced with html, and I have virtually no script experience, so this might be a dumb question that everyone but me knows the answer to.
    :
    : My layout is organized into table cells like so:
    : ------------------------------
    : | | header/graphic/ |
    : | filler | banner |
    : ------------------------------
    : | | |
    : | links | content |
    : | | |
    : | | |
    : ------------------------------
    :
    : I want the template to fill the cells for 'filler', 'header/et.al', and 'links' from a separate file (*.txt or *.htm). I know to use image for any cells that include only images, but for other cells ... how do i pull in html from a different file?
    :
    : Thanks,
    : -MW
    :

  • JonathanJonathan Posts: 2,914Member
    Hi,

    You might want to true using SSI (server side includes). You put the part you want to include in the page in a seperate file, and then put a special SSI tag into your page to include it. When the page is served, the server will see the special SSI tag and replace it with the include you've pointed at. If you want to alter the template, you just change the one file. Note you may have to give your pages the .shtml or .shtm extension to get this to work, not just .html or .htm.

    Alternatively, some web design packages (e.g. Dreamweaver from Macromedia) allow you to make a template that you can change and they will update the pages for you when you change the template. But then you have to upload all the files in your site again. On the other hand, it's lighter on the server and your pages would server (fractionally) faster.

    Hope this helps you somewhat,

    Joanthan



    -------------------------------------------
    Count your downloads:
    http://www.downloadcounter.com/
    And host your site:
    http://www.incrahost.com/
    Don't say I never give you anything... ;-)

  • aint2goodaint2good Posts: 7Member
    Thank you Jonathan. I happened to stumble across SSI myself, and it works great! Exactly what I wanted, and since I have a small site I'm not too concerned about stressing the server.

    For those who are interested, I've created a template that I'm using for this purpose. I've divided the screen into a 3x3 table, and I'm populating those cells with code from static files (cell#.txt). For any new page I want to create, I just copy the template into the desired location, rename it, and then code what I want to go in the middle cell ... this saves hours of dev time.

    I'm attaching the code for the template to the bottom of this reply. Note that you'll need to create a 'template' directory and the matching 'cell#.txt' files therein for this to work.

    -MW

    : Hi,
    :
    : You might want to true using SSI (server side includes). You put the part you want to include in the page in a seperate file, and then put a special SSI tag into your page to include it. When the page is served, the server will see the special SSI tag and replace it with the include you've pointed at. If you want to alter the template, you just change the one file. Note you may have to give your pages the .shtml or .shtm extension to get this to work, not just .html or .htm.
    :
    : Alternatively, some web design packages (e.g. Dreamweaver from Macromedia) allow you to make a template that you can change and they will update the pages for you when you change the template. But then you have to upload all the files in your site again. On the other hand, it's lighter on the server and your pages would server (fractionally) faster.
    :
    : Hope this helps you somewhat,
    :
    : Joanthan
    :




    Template Code (template.shtml) :



    This Is My Website




























  • JonathanJonathan Posts: 2,914Member
    Hi,

    : ...
    : I'm attaching the code for the template to the bottom of this
    : reply. Note that you'll need to create a 'template' directory and #
    : the matching 'cell#.txt' files therein for this to work.

    Thanks! Delighted you got it worked out. If you wish, please do post this in the CodePedia in the web development area:-

    http://www.codepedia.com/1/WEB-Development

    It could be useful for someone else. :-)

    Take care,

    Jonathan



    -------------------------------------------
    Count your downloads:
    http://www.downloadcounter.com/
    And host your site:
    http://www.incrahost.com/
    Don't say I never give you anything... ;-)

Sign In or Register to comment.