HTML & WEB-Design

Moderators: Jonathan
Number of threads: 1253
Number of posts: 3360

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
site template -- script needed? Posted by aint2good on 27 Feb 2003 at 2:01 PM
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 <img src="etc"> for any cells that include only images, but for other cells ... how do i pull in html from a different file?

Thanks,
-MW
Report
forgot to mention... Posted by aint2good on 27 Feb 2003 at 2:06 PM
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 <img src="etc"> for any cells that include only images, but for other cells ... how do i pull in html from a different file?
:
: Thanks,
: -MW
:

Report
How about SSI? Posted by Jonathan on 1 Mar 2003 at 1:35 PM
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...

Report
Re: How about SSI? -- Code example Posted by aint2good on 21 Mar 2003 at 8:26 AM
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) :


<htmL>
<head><title>This Is My Website</title><base url="http://www.mywebsite.com/"></head>

<body bgcolor="#FFFFFF" background="/images/background.gif">

<table cellspacing="0" cellpadding="0" border="0">
<tr>
<!-- Cell 1 --><td><!--#include virtual="/template/cell1.txt" --></td>
<!-- Cell 2 --><td><!--#include virtual="/template/cell2.txt" --></td>
<!-- Cell 3 --><td><!--#include virtual="/template/cell3.txt" --></td>
</tr>
<tr>
<!-- Cell 4 --><td valign="top"><!--#include virtual="/template/cell4.txt" --></td>


<!-- MAIN BODY -->
<td>

</td>
<!-- END MAIN -->

<!-- Cell 6 --><td><!--#include virtual="/template/cell6.txt" --></td>
</tr>
<tr>
<!-- Cell 7 --><td><!--#include virtual="/template/cell7.txt" --></td>
<!-- Cell 8 --><td><!--#include virtual="/template/cell8.txt" --></td>
<!-- Cell 9 --><td><!--#include virtual="/template/cell9.txt" --></td>
</tr>
</table>

</body>

</html>

Report
Re: How about SSI? -- Code example Posted by Jonathan on 21 Mar 2003 at 11:02 AM
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...




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.