Template Toolkit and databases
Andrew McFarland
andrew at mcfarland.co.uk
Mon Jul 23 13:01:50 CDT 2001
>Much as I hate to agree with Marc ;-), I wouldn't put HTML in the database
>either if I could avoid it.
>
>I would try to do as much as possible with templates, mop up the rest with
>CGI.pm
>and just store plain text in the database. If you actually store the markup
>(HTML) with the data, it makes it much harder to maintain both.
That's pretty much what I thought. However, the structure of the content
can be quite arbitrary, and vanilla HTML would probably be the easiest way
for other people (eg the assistant webmaster) to add content. At least I
think it would.
A concrete example may help. Here is a pseudo TT template for what I want
to do:
<html>
<head>
[% title %]
[% metas %]
[% stylesheet %]
[% javascript %]
[% base %]
</head>
<body>
[% pre_content %]
[% content %]
[% post_content %]
[% navigation %]
[% author_details %]
</body>
</html>
(This is slightly expanded on what I planned earlier)
Only the title, stylesheet, and content will always be there. TT is
probably overkill for this, but I will use some of it's more elaborate
features in the future.
If I wanted to store the content using XSL and XML (as Glenn suggested) how
would I approach that? Can anyone recommend some good URLs for this sort of
thing? Seeing some actual examples of code and database contents would be
very helpful.
Andrew
--
AA McFarland http://www.mcfarland.co.uk/andrew/
The LORD is my shepherd, I shall not be in want
Psalm 23:1
More information about the Belfast-pm
mailing list