Gossamer Forum
Quote Reply
global variables
what language are the global templates written in? perl?
-simon
http://www.fatscripts.com
Quote Reply
Re: [lastsaga] global variables In reply to
The global.txt file is a hash dump, that includes keys and references to subroutines.

The code is all PERL for subroutines, but the file itself is just a hash key/value pairing of data.

Using the admin->templates->global editor is the best way to edit it. Otherwise, you can do some _massive_ damage.

One caveat is that the first line of a subroutine needs to be only five characters "sub {"

I'm not sure if this has changed in the most current release, but it's safest to make sure for backwards compatibility.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] global variables In reply to
so if i want to write any custom global variables i need to write it in perl and start it with a "sub {"
-simon
http://www.fatscripts.com
Quote Reply
Re: [lastsaga] global variables In reply to
Yes.

You have automatic access to the links internal variables $DB, $CFG and $USER.

They work as expected -- $USER is the current logged in user, for example.

You might want to look at some of the posted globals here for specific examples of how to pass parameters in from the templates, to access the current template data set, and to pass data back.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] global variables In reply to
i'm assuming $DB is the info to connect to the database?

what is $CFG?
-simon
http://www.fatscripts.com
Quote Reply
Re: [lastsaga] global variables In reply to
$CFG hold all the configuration values that you set in the admin->setup area.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [lastsaga] global variables In reply to
Example;

$CFG->{build_root_url}
$CFG->{admin_email}
$CFG->{debug}

...etc

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!