Gossamer Forum
Home : Products : DBMan : Customization :

MOD: DBMan Templates in zip file for stand alone DBMan Templates

Quote Reply
MOD: DBMan Templates in zip file for stand alone DBMan Templates
Because I got requests for a "links-less" version of DBMan Templates I have just cleaned up and made a leaner version of DBMan Template that will run without various links routines. This is in a zip file at:

http://incorp.net/demos/dbman_templates.zip

This zip file only contains the changed and new modules and requires you to download or already have the other dbman modules.

This should run with your current versions of dbman. But will require some modifications to the dbm_templates_html.pl driver module based on your dbman.cfg's record def fields you want to pass to the templates.

Let me know how it works so I can update any doc on
this.

1. Let me know if it downloaded ok.
2. Tell me if you think anything is missing after you try it.
3. Let me know of any suggestions to make the process easier to understand
and/or install.
4. Be sure to read the "readme file" on what is included and not included in the package.

Hope this helps.
TimRyan


[This message has been edited by timryan (edited August 31, 1999).]
Quote Reply
Re: MOD: DBMan Templates in zip file for stand alone DBMan Templates In reply to
IMPORTANT:
Please note that I am currently working on (with some success) upgrading the templates module so you will NOT have to insert your fields. Soooo, you might want to wait a bit if you are doing anything but testing with my current db fields. Smile

TimRyan


[This message has been edited by timryan (edited August 31, 1999).]
Quote Reply
Re: MOD: DBMan Templates in zip file for stand alone DBMan Templates In reply to
UPDATE:
I just completed testing the new changes put in that makes life easier in the fact that the templates driver now automatically pulls in the %rec from the def routine in your .cfg file. This narrows down any required changes in the dbm_templates_html.pl module to almost nothing.
The most current version can be had at:
http://incorp.net/demos/dbman_templates.zip
TimRyan

Quote Reply
Re: MOD: DBMan Templates in zip file for stand alone DBMan Templates In reply to
Hi Tim!

My apologises for being off topic - Is the links version finished or still in beta testing.

Many thanks.



------------------
http://www.nzcid.godzone.net.nz
New Zealand Christian Internet Directory


Quote Reply
Re: MOD: DBMan Templates in zip file for stand alone DBMan Templates In reply to
Thanks Ian Conza for bring this to my attention. I have set up a thread for posting on the mentioned project at:
http://www.gossamer-threads.com/scripts/forum/resources/Forum12/H
TML/000881.html

Also, I just did some docs and zip file on this at:
http://incorp.net/demos/dbman_links_integration.zip

Hope this helps. You (and others) may post question on the dbman/links2 Integration at the latter thread.
TimRyan


[This message has been edited by timryan (edited September 01, 1999).]
Quote Reply
Re: MOD: DBMan Templates in zip file for stand alone DBMan Templates In reply to
Just downloaded the mod and got it working in about 5 minutes -- just a quick question. 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?

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.

Thanks again for the mod, I can't wait to get it running seamlessly into my site!

------------------
Jason
Extreme mtb
http://extreme.nas.net
Quote Reply
Re: MOD: DBMan Templates in zip file for stand alone DBMan Templates In reply to
Can someone tell me what the advantages of a template version of DBMan is?

Just wondering?

Thanks
---------------
donm
Quote Reply
Re: MOD: DBMan Templates in zip file for stand alone DBMan Templates In reply to
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. Smile

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. Smile 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 Smile 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. Frown 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. Smile 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. Smile

Let me know if you need more detail on this.

TimRyan


[This message has been edited by timryan (edited September 01, 1999).]
Quote Reply
Re: MOD: DBMan Templates in zip file for stand alone DBMan Templates In reply to
donm you said...
quote
_______________
Can someone tell me what the advantages of a template version of DBMan is?
_______________

Good question. Smile The bottom line answer to this really depends on what their individual needs are and how deep one is into web site design.

Because some folks may not have a need for templates (and because I like choice), I have put a switch in DBMan that allows one to use either templates or they can use the current html.pl (or use JPD user-friendly html.pl... which I must add, makes life very easy and with its design can be more usefull to some users).

The intention of Templates is to prevent the user from needing to put in or change code into DBMan (or any other program such as links) every time they have to change the looks of their web pages or site. Hence, all the web page (html) code is outside of the original program with each web page having its own html file.

The less one has to "touch" a working program the better. If one "goofs" on a web page change the odds are 100% it will not bring down the entire system.

If you use templates, you can call up each web page (html file) with your favorite web page editor and have the "What U See Is What You Get" instant look of your web page(s). This is the most important reason for those who maintain a lot of web pages.

The latter also allows you to do many things one could not do with a web page that was hard coded within the original cgi script/module. You can use ssi, java script, etc.

You can pass fields/variables to a web page without even touching any code in the original cgi script (in most cases). Because the new field is instantly passed in the %rec field and on to the templated web page as
<%New_field_exactly_as_spelled_in_def%>

One could design ready made user packages that do not need any perl knowlegde to use.
(see links yahoo, snap, webcrawler, etc look a like templates for an example)

In the Gossamer Resource Center there are currently 67 mods for DBman and 300 mods for Links. Now that we have DBMan Templates this could open up a lot of new ideas and uses for DBMan both on its own and with the use of the current Links Mods.

I am sure others can share with us as to why they like or use templates and/or they do not like or use templates Smile.

You could also take a peak at the links forum and do a search on templates to see why they use them. There are a lot of mod for links that can now be used in DBMan that could not be used in the past. Sort of like why windows became very popular over IBM... there are lots of programmers doing mods. Sort of like a snowball rolling down a hill Smile

I must add that if one uses Templates, it is not because it is "better" than using html.pl, etc. but, rather because it is just a different way for one to choose towards web page management.

Hope this helps.
TimRyan



[This message has been edited by timryan (edited September 01, 1999).]
Quote Reply
Re: MOD: DBMan Templates in zip file for stand alone DBMan Templates In reply to
I tried to add the sub html_header that you mentioned but I cannot get it to work.

I tested it out by putting in the subroutine as you suggested, added

html_header => $html_header,

to the html_add_form (this was the routine that I tested on)

and inserted <%html_header%> into the add_form template. When I viewed the page that calls the add_form, nothing showed up.

What am I doing wrong? I would like to make the html_footer look to a template as there is no template for it - that would be the same as the html_header right?

I would also like to have some globals for all of the pages. For example, I would like to have 1 set of font definitions for all of the subroutines instead of having <font size... etc.> wherever I want to change the font stuff. So in the future, I only need to change the fonts once instead of many times on each template. I would also like to add things like <hr>'s to the globals as well as other frequently called items such as spacer images and stuff like that - could you advise me on how to do that or point me to a tutorial that describes how to do these things.

Thanks. This is tedious work now but it'll be great in the end!

------------------
Jason
Extreme mtb
http://extreme.nas.net
Quote Reply
Re: MOD: DBMan Templates in zip file for stand alone DBMan Templates In reply to
You can hold off on these if you want. I will work on this tonight and upload what I get done on the header/footer templates and routines. Then we can workon the other passes.

I had the fonts => $fonts put in but took them out because they messed up my templates when used in my html editors. But if one is doing templates by hand I could see a use for them and will do a template example for that also.

TimRyan
Quote Reply
Re: MOD: DBMan Templates in zip file for stand alone DBMan Templates In reply to
OK this footer template mod is at:

http://www.gossamer-threads.com/scripts/forum/resources/Forum12/HTML/000883.html

I was going to put it in a thread but to big.. Smile

Have fun
TimRyan
PS. Will do a header template late in day too. Smile
Quote Reply
Re: MOD: DBMan Templates in zip file for stand alone DBMan Templates In reply to
TimRyan,

Great job! I had a chance to look over the scripts...I would also like to see how global variables could be added. That would be a great feature to have!

Looks easy to add in new templates as well.

Cool!

Keep up the great work!

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us
Quote Reply
Re: MOD: DBMan Templates in zip file for stand alone DBMan Templates In reply to
I have it installed and now I'm going to customize de default.cfg (the DB itself)

I know that in the HTML file I have to change $rec{'Fieldname'} with <%Fieldname%>

But at the read-me file that comes up with the MOD said that I have to change dbm_templates_html.pl, but I did not find anything to change regarding the DB fields.

[TimRyan's in Readme]
However, you will have to add new fields
within the dbm_templates_html.pl if do not use my current db.cfg file definitions.To get a
better understanding of template usage you should go to Gossamer Threads and download there
links information and read up on templates. You should also do a search on "Templates" in the
Gossamer Threads Links forum. The forum is full of help and info.


Thank's!



------------------
I'm not a programer, but I want to know more about computers to understand what is happening.
Quote Reply
Re: MOD: DBMan Templates in zip file for stand alone DBMan Templates In reply to
 
Quote:
But at the read-me file that comes up with the MOD said that I have to change dbm_templates_html.pl, but I did not find anything to change regarding the DB fields.

All you have to do is edit the default.cfg file with the fields you want in the %db_def file.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
Anthro TECH, L.L.C
anthrotech.com
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.


Quote Reply
Re: [timryan] MOD: DBMan Templates in zip file for stand alone DBMan Templates In reply to
I tryed to download the template *.zip file but got a 404... Has this file moved?? Any help would be greatly appreciated!!



thanks Smile,

jason
Quote Reply
Re: [jasondoss] MOD: DBMan Templates in zip file for stand alone DBMan Templates In reply to
Try this url:

http://webmagic.hypermart.net/dbman/dbman_te.zip

I have a temporary copy on the FAQ site.

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] MOD: DBMan Templates in zip file for stand alone DBMan Templates In reply to
THANKS!!!!
Quote Reply
Re: [LoisC] MOD: DBMan Templates in zip file for stand alone DBMan Templates In reply to
is this mod still available? if so, where? thanks
Quote Reply
Re: [delicia] MOD: DBMan Templates in zip file for stand alone DBMan Templates In reply to
It's still at the FAQ site, but the url has changed to:

http://redundantcartridge.com/cgi-bin/dbman/dbman_te.zip

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] MOD: DBMan Templates in zip file for stand alone DBMan Templates In reply to
i get an error using that link too.

figured it out. http://redundantcartridge.com/dbman/dbman_te.zip
not in cgi-bin!
thanks

Last edited by:

delicia: Feb 17, 2008, 12:25 PM