Gossamer Forum
Home : Products : DBMan SQL : Discussion :

Re: [jai] access same template global within more than one template set

Quote Reply
Re: [jai] access same template global within more than one template set In reply to
I'm still figuring out how to get the most use out of DBManSQL myself, so I'm happy to share what little I'm learning. Smile

For my very first foray into creating a new perl module I created Custom.pm, which for now contains two very simple subroutines (just used for testing purposes, really):

get_today - returns today's date
get_today_plus90 - returns a date 90 days from today

After putting these both in the Custom.pm file, which is uploaded into the admin/Dbsql directory, they can be called from within any template by using something like:

Today is <%Dbsql::Custom::get_today%>
In 90 days it will be <%Dbsql::Custom::get_today_plus90%>

The format is pretty much just:
<%Dbsql::[NAME_OF_MODULE_W/O_EXTENTION]::[SUB_ROUTINE]%>

As far as I can tell, all perl modules are available from all templates, so this is a good way to accomplish the equivalent of cross-template globals.

Custom.pm, such as it is, is attached.

Fractured Atlas :: Liberate the Artist
Services: Healthcare, Fiscal Sponsorship, Marketing, Education, The Emerging Artists Fund
Subject Author Views Date
Thread access same template global within more than one template set hennagaijin 4412 Oct 7, 2002, 3:11 PM
Thread Re: [hennagaijin] access same template global within more than one template set
hennagaijin 4308 Oct 7, 2002, 3:42 PM
Thread Re: [hennagaijin] access same template global within more than one template set
jai 4276 Oct 7, 2002, 4:03 PM
Thread Re: [jai] access same template global within more than one template set
604 4268 Oct 7, 2002, 4:19 PM
Thread Re: [TheStone] access same template global within more than one template set
jai 4240 Oct 7, 2002, 7:04 PM
Post Re: [jai] access same template global within more than one template set
604 4200 Oct 8, 2002, 10:57 AM
Post Re: [jai] access same template global within more than one template set
hennagaijin 4269 Oct 7, 2002, 4:28 PM