Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

Script Results in Links Template

Quote Reply
Script Results in Links Template
Hello, I have a script that calculates some form values to determine a stock valuation and I would like the results to be returned in a Links template instead of it's current template to keep it under the system. I would also like to do this with a bunch of other scripts that I have, calculators and so forth. Can somebody tell me how to go about this, will this be easy?

Thanks
Shane


Quote Reply
Re: Script Results in Links Template In reply to
Hi,

easy or not is a matter of the view.

If you have your values in a cgi script you can call a function in HTML_Temolates to build your desired page.

1. Make a template for every page.

2. make a new sub in HTML_Templates like html_build_special.
which also accepts the template name as a parameter and uses this parameter to build the page.

3. convert your data to a hash and pass it to your sub together with your template name.

If you understand how HTML_Template.pm builds the pages it will be no problem modify your script the way I proposed.

If not -- ask someone to do it for you. ;-)

regards, alexander

Quote Reply
Re: Script Results in Links Template In reply to
Alex, pretty close :)

You still need to "use" the Links.pm file for the basic defaults of all the modules.

Depending on what your script is trying to do, look at the headers for jump.cgi, add.cgi and search.cgi for which ever is closest to the type of script you are creating.

Then, use those headers to "use" the various libs and modules in the Links subdirectory. You need to specify that, since the various routines are somewhat related. If you are not using the database utiltiles at all (like no SQL calls) you can probably not load the DBSQL.pm and DB_Utils.pm, but you'll have to see. There might be some linked code in that you need to use, or at least create a dummy value for. (I've never not written an SQL program since starting with Links <G>).

Once you include the modules, you can then use any of the existing output routines, or make your own output routines, or even call &load_template directly if you know what you are doing.

I've used the links template parser to move all my programs (except hamweather) into the central links database system, so It can be done :)

I've not taken the time to prune, pare down, the various files to eliminate the unnecessary to increase performance for some programs, since the new version of links is on the way.

Besides.... if the program gets modular enough, the various .pm files can be compiled/loaded into Apache on start up, and then you don't have to worry about performance penalties or anything :)


BTW... using the Links.pm file is only if you use the modules as-is. If you start to prune them, or tune them for non-links use, you can cut out a lot of fat, and still get template performance from the routines. But HTML_Templates.pm requires some $LINKS variables set in the Links.pm file to load/run right.


http://www.postcards.com
FAQ: http://www.postcards.com/FAQ/LinkSQL/

Quote Reply
Re: Script Results in Links Template In reply to
Thanks for the replies guys, I have a handfull of scripts that I will try to intergrate in the future such as calculators so now I have a better idea at what it would take. Still to much for me to handle so hopefully when I do it I can have a hand :)


Shane