suicide1405241470 0 Report post Posted September 10, 2004 Hello All,I am very new to this site, and even to web development.I was given a task to make a site using html(and anything I am intrested in). This site would have a common template along all the pages in it.Now what I want is, Is there any way to define a template using HTML.If yes how?If no, what is the other easiest option for it. I dont like to code the sanme stuff in all the pages. Is there any way of data reusability.I thought of some other way, like making a page with the template(that continues through all the pages in site) and calling that page in each and every page, I made that page, but I dont know how to call that page in all my pages,Could anybody help me?Thanks for your help. Share this post Link to post Share on other sites
Nisshutsu 0 Report post Posted September 10, 2004 Yes, in order to make your website look uniform you could use the same coding, but what I would do is use a css script with a set defined styles for your text, tables, and background. By using a css script, you will save yourself the trouble of having to edit very long html files. This will help you change the look of your page instantly by only editing one file and make the website as a whole look more professional. That is what I would do. Share this post Link to post Share on other sites
SinisterMinisterX 0 Report post Posted September 12, 2004 There is no way (that I know) to 'call' a template page from another HTML page. In order to do this, you have to use PHP or similar server-side processing. But here's what I would suggest: Create your 'template' file in such a way that all the content which changes from page to page is localized in a few areas. Indicate the location of the content with HTML comments. Save this file on your hard drive as 'template.html'. It might look something like this (a snippet from one of my own templates): <td class="main"><!-- CONTENT GOES HERE --></td> All the primary content for the page will always go in that one table cell. When I want to create a new page, I bring up template.html and replace the comment with my content, then save the new file under a different name (preserving the original template file). The upside is that once your template is created, you can concentrate on creating content and not have to worry about page layout anymore. The downside is that all your HTML code still resides in each and every page; if you want to make a global change to your layout, you have to edit every single page. Like I said above, you really need PHP to get the effect you're seeking. If your host supports PHP (like Xisto), this is simple. In this example, I'm assuming that all your HTML above and below the content never changes. Open your template.html file. Take all your HTML from above the content area, cut and paste it into a new file, and save the new file as 'header.php'.Take all the HTML from below the content area, cut and paste into another new file, and save it as 'footer.php'.Create a new file called 'template.php' which looks like this: <?php include "header.php" ?>PAGE BODY GOES HERE<?php include "footer.php" ?> Upload header.php and footer.php to your web space, but leave template.php on your hard drive.As before, replace 'PAGE BODY GOES HERE' with your actual content, save under a new filename, and upload your new page to your web space.This second method will allow you to make global changes to your layout easily. Any change to header.php or footer.php will instantly be included in all your content pages without changing each page manually. Just remember that every page has to be saved with a .php extension, not .html . Aside from this minor usage of PHP, you'll still be using HTML for everything else. Hope that helps, SinisterMinisterX Share this post Link to post Share on other sites
sanjulian 0 Report post Posted September 13, 2004 Like SinisterMinister X said, the only way to obtain what you want is using php or other server languaje. Continuing with his second suggestion: In the header we normally need that at least the page title change, so you need to include a variable wich defines it, something like this: File: header.php <?phpif !isset ($page_title){ // If is $page_title is not set, then a default title is assigned$page_tile="Default Title";}?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><title> <?php echo $page_title; ?> </title></head> The value of $page_title can be defined in the template, like this:File: template.php <?php$page_title="Put your title here"; // Don't forget to edit when adding a new pageinclude "header.php";?><body>HERE GOES YOUR BODY</body><?php include "footer.php"; ?> As an alternative, you can define the $page_title value in the link to your page and even you can use only your template.php (in your server) to display all the pages of your site. To do this you need especify a new variable for the file name of the body, like $body. Assuming that you put all your bodies in a folder named bodies/, the link in your menu should be something like this: http://yourdomain.com/template.php?page_title=Your Title&body=bodies/anyname.txt The template must be something like this: File: template.php <?phpinclude "header.php";include $body; // the <body></body> tags in this case must be in anyname.txtinclude "footer.php"; ?> Aditional tip:Avoid using FONT and similar tags, use the css Share this post Link to post Share on other sites
iGuest 3 Report post Posted September 16, 2004 Hello All, I am very new to this site, and even to web development. I was given a task to make a site using html(and anything I am intrested in). This site would have a common template along all the pages in it. Now what I want is, Is there any way to define a template using HTML. If yes how? If no, what is the other easiest option for it. I dont like to code the sanme stuff in all the pages. Is there any way of data reusability. I thought of some other way, like making a page with the template(that continues through all the pages in site) and calling that page in each and every page, I made that page, but I dont know how to call that page in all my pages, Could anybody help me? Thanks for your help. <{POST_SNAPBACK}> the basic code for html is.... <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://forums.xisto.com/no_longer_exists/; <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Untitled Document</title> </head> <body> </body> </html> Share this post Link to post Share on other sites
neo_28052 0 Report post Posted September 17, 2004 i would put another way to do it. but i cant think of anymore. you can find some stuff at http://www.flamingtext.com/ Share this post Link to post Share on other sites