Jump to content

Templates


Darwyn
 Share

Recommended Posts

What is the best way to create a template?I'm just not sure what the best practice is...is it using Dreamweavers .dwt file? using php's "include" function?I created my site using strictly <div> tags and CSS. I need to create other pages based on this design...what is the best way?thanks!

Link to comment
Share on other sites

C'mon guys! I figured this was a simple question. 4 hours and 15 views and no answer?! I'm VERY disappointed in this site. Perhaps I should find another... :) Let me put it this way...if someone hires you to create a multipage website with a common header and footer in each page, you need a way to update that header and footer information within some sort of template so you aren't making those changes to each page you create...what is the best way to do that? With Dreamweavers .dwt file? what do you use?

Link to comment
Share on other sites

I'd use PHP to include files, or make a template engine.I've never used Dreamweaver so I don't know how "dwt" files work, but I don't think they work on the server-side, so if you make a change to something you would still have to upload all the files rather than just one.

Link to comment
Share on other sites

I'd use PHP to include files, or make a template engine.I've never used Dreamweaver so I don't know how "dwt" files work, but I don't think they work on the server-side, so if you make a change to something you would still have to upload all the files rather than just one.
Thanks for the response!Would you say that using php includes is the standard for this sort of thing?Also, does that mean that all my pages need to have the .php extension? How does that work for index.html?Are there other ways to create a template?
Link to comment
Share on other sites

PHP, or other server-side languages, is the way to include files into others. You need a .php extension on most servers in order to run PHP, but the server can be configured to execute PHP in other types of files.A template engine is programmed in PHP or another server-side language. It's meant to take HTML templates and fill in certain parts of it with database information or other content. It's a little complicated, for now you're better off just using includes.

Edited by Ingolme
Link to comment
Share on other sites

Just a comment: people may have been slightly unsure as to what you mean by "template", and therefore reluctant to answer your question. PHP includes (or any form of server-side inclusion) allow you to concatenate various files together on the server, in order to reduce the amount of duplicated code. Dreamweaver's template functionality, on the other hand, presents you with a pre-written piece of code with certain section read-only, which are then filled in. However, each file still retains all the code once you upload it to a server, and therefore does not convey the same kind of benefits. This would be fine for your purpose, though it gets harder to maintain as you go along.Most web applications (example: phpBB) use a templating engine, because this provides more flexibility than the previous two options. With no understanding of the underlying application architecture, users can create their own code, and even use logic to help define what their pages will look like with regard to, for example, a repeating section such as a block containing a user's post.In general, servers will also server up index.php as an index page.Also, people on this forum are from all around the world - a convenient time for you to be online may be in the middle of the night for them (e.g. 3:34am for me). Patience! :)Note that you should use semantically proper tags on any HTML page - not just divisions.

Link to comment
Share on other sites

C'mon guys! I figured this was a simple question. 4 hours and 15 views and no answer?! I'm VERY disappointed in this site. Perhaps I should find another...
Agreed. Edited by Deirdre's Dad
Link to comment
Share on other sites

Agreed.
Yes, thanks Dad! It's nice to know that you think you've reached your apex in terms of users on this site that you can afford to write them off when they express frustration.I had expressed my frustration because I saw a few other threads being responded to while mine sat idle as it increased in the amount of views (ie. many people looking, no one responding). But while it was idle, I tried to help another user while I waited.My apologies to you sir, for not realizing that the level of intolerance on these boards were so low. Anyway, to the others...thank you for those of you who took the time to respond with solid information...it's been very helpful and is appreciated.
Link to comment
Share on other sites

Venting frustration is understandable. It was the mud-slinging I found objectionable. We generally talk about code, not each other.From time to time you will notice that some threads get more attention than others. It's rarely personal. As Synook mentioned, it generally reflects the way the question was posed. When you say "templates," designers rarely think about the sort of thing you had in mind. If you Google "HTML Templates" you'll see why.

Edited by Deirdre's Dad
Link to comment
Share on other sites

well you did just slag off/write off a bunch of people for not giving you the answer you wanted as immediately as you expected it should have been answered. As Synook mentioned, you're question wasn't as simple as you may have thought, and without more specificity on your part, some of us weren't really sure what you meant. I only chimed in later after the ball got rolling.More importantly, now that you've made a personal swipe at DD, you've probably done even more to make us feel like you SHOULD find another site. I applaud you for helping someone out, with that being one of your 14 posts. I don't suppose you bothered to check the amount of posts DD has and bothered to see that nearly 99% of them involve contributing to, and helping everyone on this board, like you, who is new and/or has questions. You're a little brazen for being so critical of board when you've barely made yourself known. You know what they say about first impressions. (personally, mine was you're less than constructive criticism of roundcorners' website. If you're going to be that critical of something that no one until you had even mentioned, why not offer an alternative? Or maybe just phrase it in a less condescending way...)

Link to comment
Share on other sites

Comment: this isn't a for-profit forum, where the sole purpose is to attempt as many visitors or members as possible. Neither is it a helpdesk, where teams work around the clock to bring enterprise-class solutions. Rather, it is a simple bulletin board, operated by volunteers who enjoy helping people in their self-driven quests to improve their web development skills. We do this because we want to, and because it is something that we believe will be useful; nevertheless, we do have other things to do as well, and are not paid to answer the questions or sit around on the board pressing F5. Maybe you will find this on other sites, but it is not how we operate here. As you can see, your question was answered, despite your skepticism - and this is the way we work. If you don't like it, then you are free to leave - but I wouldn't hold it against us.

Link to comment
Share on other sites

Venting frustration is understandable. It was the mud-slinging I found objectionable. We generally talk about code, not each other.From time to time you will notice that some threads get more attention than others. It's rarely personal. As Synook mentioned, it generally reflects the way the question was posed. When you say "templates," designers rarely think about the sort of thing you had in mind. If you Google "HTML Templates" you'll see why.
Yes, the google search was exactly what lead me to post in the first place. I could not find anything that wasn't a site offering to sell pre-built templates. My sincere apologies. I figured it would have been an easy question and when I didn't see a response, I got frustrated. Perhaps I didn't phrase the question as well as I could have.My apologies to everyone on this thread too. Anyway, I was finally able to figure it out so I'd like to post my results for future reference aimed at those who are not as impatient as myself. :)Here's what I did:I created my design in photoshop. When the client liked the design, I then translated my photoshop file into html using strictly CSS and DIV tags. The index.html page was complete. But then I needed to create other pages based on that design. So I broke apart my header, footer and the main content of the page into three separate HTML files.Using SSI, here is the final template:<body><div id="main"><div id="content"><!--#include file="header.html" --><!--#include file="main.html" --></div></div><!--#include file="footer.html" --></body>Now all I need to do is create my content in a separate HTML document, open this file and replace "main.html" with the new HTML file. Thanks again. I hope this can be a lesson in patience AND templates for everyone. :)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...