Re: Can a Template file be an HTML file?
by tcf03 (Deacon) on Jun 14, 2005 at 05:25 UTC
|
| [reply] |
Re: Can a Template file be an HTML file?
by polettix (Vicar) on Jun 14, 2005 at 10:10 UTC
|
The filename extension usually gives you a broad idea of the contents, so I wouldn't go for it. In a remote future (1 month) you could be happy to remember that your template stuff was in those weirded-named files ending in tmpl, and be able to separate it from the plain html. Moreover, I'd keep those files outside the directory tree exposed by the web browser, because someone could access those pages directly. So, these pages aren't strictly HTML (at least in their semantic) and aren't to be served by the webserver directly - why would you call them html?
Flavio (perl -e 'print(scalar(reverse("\nti.xittelop\@oivalf")))')
Don't fool yourself.
| [reply] [d/l] [select] |
|
|
Actually, my advice is the opposite. Put your templates in a template directory, and then keep the .html suffix. Then, when I load the file in most html editors, they recognise it immediately from the suffix. They don't quite "get" the tmpl_ tags, but I can highlight things and mark them "strong" or "em"phasis or "div" or whatever. (For some reason, I don't think my editor allows blink. Oh well :-})
This way, I get all the shortcuts for adding tags, I get the syntax highlighting, and I know they're templates from the directory they're in.
I actually started with your advice: new name, outside directory. I went back on the name because I found I was always telling my editor to pretend that .tmpl was actually HTML, so I cheated by putting them in files that the editor understood were HTML.
And I'm even more glad I did now - I have another templating system based on Text::ScriptTemplate that I use at work where .tmpl is now taken for that - and having my editor autoload .tmpl as HTML would make those look very, very silly. (No, that's not used for webpages, but for almost anything else - including shell scripts.)
| [reply] |
|
|
The syntax-highlighting hint seems quite good indeed, and as long as one is able to quickly understand which kind of files s?he's dealing with you're perfectly correct (BTW, even a find would remain useful). OTOH, one can use different filename suffixes for different purposes, so you could easily associate .tmpl to HTML highlighting, and say .stpl to the other templating system - but it really becomes a matter of pure personal taste at this point.
Flavio (perl -e 'print(scalar(reverse("\nti.xittelop\@oivalf")))')
Don't fool yourself.
| [reply] [d/l] [select] |
Re: Can a Template file be an HTML file?
by merlyn (Sage) on Jun 14, 2005 at 11:32 UTC
|
Ignore any answer in this thread that doesn't ask about your web server configuration. It really really depends on that. You can make ".html" mean "this is a gif file", or "redirect this user to www.google.com".
So, the first question is, "who set up your configuration?" and if that's not you, ask them the question you posted. If that's you, then you'll need to tell us more before anyone can help.
| [reply] |
|
|
Since he's going to be using these as templates via HTML::Template, why would it matter how the web server classifies them?
| [reply] |
|
|
Your quest for more information seems to imply that you don't agree with keeping template files outside of the webserver directory tree. If this is the case, could you please elaborate on that? If you otherwise agree on that, I don't understand what kind of influence the web server configuration would have.
Flavio (perl -e 'print(scalar(reverse("\nti.xittelop\@oivalf")))')
Don't fool yourself.
| [reply] |
Re: Can a Template file be an HTML file?
by PodMaster (Abbot) on Jun 14, 2005 at 05:19 UTC
|
You can't have .html or .tmpl. All your template files have to end with .stu :p
filename can be anything
| MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!" | | I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README). | | ** The third rule of perl club is a statement of fact: pod is sexy. |
| [reply] |