jdulberg you said,
Quote:
_____________
Just downloaded the mod and got it working in about 5 minutes ...
_____________
Thanks for that bit of reassurance jdulberg It makes the days worth of time I spent on the docs worth its while.
Quote:
___________________
Would it be a better idea to have the header/footer info in a template or just put all of that stuff into each template?
___________________
This is a very good question and one that also brings a few more questions up. By using search function on the Links forum on the keywords "header" and "footer" one will notice a couple of different ways to put headers/footers in a template. To save space here (and you will find it a very worth while experience) it would be worth one's time to use this. You will find a ton of info on this. Feel free to stop back to this thread and ask any questions or suggestion on the route you choose after your readings.
In the meantime, I will give your questions (all of them) some thought and I will share my views on them here.
To answer your original question, I would use a different template for each header/footer and then put in a routine for the header
lets call it... sub html_header { ...
or something close to that (not sure if there is already a routine called that so check). Copy it just like the one I use for the &html_footer.
$html_footer = &html_footer;
above that put code...
$html_header = &html_header;
Then just pass the <%html_header%> in the routines where you see
html_footer => $html_footer,
This is not tested and is off the cuff. I will be doing this for myself eventually but feel free to ask me to start a thread on that if you need help on trying it yourself.
Woops!... hehe
Sorry bout that. I just noticed that the html_footer is still hard coded and not in an html template. Hmmmm., thought I did that.
Anyway, the latter should still work. We just have to go one step further and put all that stuff in a template that calls the loadtemplate routine.
I will see if I can get to that soon.
Quote:
_________
I would like to read up on how to add fields to the templates - where can I find this information? You mentioned it in the readme file but searching gives a ton of hits and I can't seem to find the info in the
Gossamer Threads resources.
_____________________
I just did a search also and had the same problem. hmmm, maybe I was thinking of "how to add a field to the db" when I mentioned that. Actually, I just gave a brief explain of that above. But to rehash this a bit...
here is a brief tutor.
Using an example....
____________________
print &load_template ('anytemplate.html', {
html_footer => $html_footer,
%rec
});
________________________
What this does, in a nutshell, is...
'anytemplate.html' tells Template.pm the name of the template file to load in.
Then this is how you pass a variable...
this code in the routine that captures the variable...
html_footer => $html_footer
basically says... every time I see <%html_footer%> in a template that I will pass to the template the variable $html_footer "as it was set" in the current routine.
Also, since I just put in the "%rec" (where needed) we no longer have to pass each and every field in %rec (as in the normal way I mentioned above). Instead, Template.pm is smart enough to pull out all the feilds you include in your .cfg "def". Template.pm pulls these from %rec because I pass %rec to it (see above).
NOTE: Because %rec is passed as a whole, you can add or take out db fields and they will all be passed automatically in %rec. Read the internal docs on this in the code for more on this.
This also brings up a point I do not explain very well in my docs. The point of using a build_select variable/field. So, if anyone has anyquestion on this, after looking over the examples I use in add.html on passing this in hidden fields, etc. ... well, just let me know.
One final "tutorial" note. I named all the routines in the dbm_db_templates_html.pl the same sub name as the old html.pl. If you look at each routine in the old html.pl and analyze those with what I put into the same named dbm_db_templates_html.pl routine; then look at the .html template with the corresponding name (and its <%variables%> you might see exactly what I have done and what one can do to add their own routines, variables, and/or fields.
Hope that was not to brief.
Let me know if you need more detail on this.
TimRyan
[This message has been edited by timryan (edited September 01, 1999).]