Gossamer Forum
Quote Reply
globals in dynamic mode
It is possible to create a global for use in dynamic mode that would mimic ssi or allow inclusion of a text file in a dynamically generated page?

CCUnet
my Christian web
Quote Reply
Re: [ccunet] globals in dynamic mode In reply to
New global called ssi_included

Code:
sub {

my $file = shift;
my $output;

open(OPEN, "$file") || return "Cant open file. Reason: $!";
$output = <OPEN>;
close(OPEN);

return $output;

}

Then call it via something like;

<%ssi_included("/path/to/the/file/you/wanna/include/file.txt")%>

This is untested...but I don't see why it shouldn't work Smile

Hope that helps...

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!
Quote Reply
Re: [Andy] globals in dynamic mode In reply to
Andy,

Thanks works like a charm.

Now if I can just figure out a substitute for my exec cgi calls and get my cool page build problem fixed I'll be in good shape.

I should really learn how to write globals thay see to solve a lot of problems with reusable text

Thanks again

CCUnet
my Christian web
Quote Reply
Re: [ccunet] globals in dynamic mode In reply to
Try something like;

Code:
sub {

require "/path/to/script.cgi";

my $output = &sub_that_needs_calling_in_above_script;

return $output;

}

Hopefully something like that would work...again, untested Wink

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!
Quote Reply
Re: [Andy] globals in dynamic mode In reply to
Andy,

I little slow on the uptick here. Not sure i understand this part. Does my exec cgi command go there or the sub routine fromthe actual cgi

ccunet

In Reply To:
Try something like;

Code:


my $output = &sub_that_needs_calling_in_above_script;
my Christian web
Quote Reply
Re: [ccunet] globals in dynamic mode In reply to
What exec command are you trying to run?

An example of how to run it would be;;

Perl Script;

Code:
#!/usr/bin/perl

sub test_sub {

print "here is my test dsub routine";
print "do whatever i want here...";

}

Then for the global, something like;

Code:
sub {
require "/path/to/script.cgi";
my $output = &test_sub;

return $output;

}

If its just a script that needs no variables passed to it, you could try something like;

Code:
sub {

my $output = `perl /path/to/script.cgi`;
return $output;

}

SHOULD be as simple as that Tongue

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!
Quote Reply
Re: [ccunet] globals in dynamic mode In reply to
There is an <%include%> tag in the template system.

check the docs:

.../admin/admin.cgi?do=help&topic=GT/Template.html

The file needs to be in the current default template directory though.

This thread:

http://www.gossamer-threads.com/...i?post=223053#223053

Also has some interesting ideas, for those who may say "Hmmm... I need soemthing like this."


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] globals in dynamic mode In reply to
My globals better, cos it lets you include a file from anywhere in the root folder heirarchy Wink

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!
Quote Reply
Re: [Andy] globals in dynamic mode In reply to
So does the <%include%> tag.

Try

<%include /etc/passwd%>

Cool

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] globals in dynamic mode In reply to
Does it? Blush Wow...thats news to me...LOL

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!