Gossamer Forum
Home : Products : Gossamer Links : Discussions :

<%include <%user%>.txt%> problem

Quote Reply
<%include <%user%>.txt%> problem
Do you have an idea haw to include file from parameter?
script.cgi?user=test
and then to includu file test.txt
<%include <%user%>.txt%>

Thanks in advanced.
Quote Reply
Re: [Troja] <%include <%user%>.txt%> problem In reply to
I don't think you can do that. To accomplish that you would have to create a global to do it.

Adrian
Quote Reply
Re: [brewt] <%include <%user%>.txt%> problem In reply to
Is there a solution for this?

In my links DB i have a field that = somefile.html

I want to pass a parameter inside <%include%> so that the DETAILED page contains somefile.html

<%include <&somefilevariable%>%>

Any way to acomplish this using INCLUDE or a GLOBAL?

I am using DYNAMIC mode for the pages.
Quote Reply
Re: [Rob Hernandez] <%include <%user%>.txt%> problem In reply to
I've been looking for that same solution. When talking to Aki at GT he suggested trying SSI (Server Side Include). Looks like you can place a SSI in a column and then call that column in your templates. Haven't tested it yet but it seems like it should work.

Take a look at these pages and you'll see what I mean:

http://www.bignosebird.com/ssi.shtml
http://www.bignosebird.com/sdocs/include.shtml

Hope that helps and if it does let me know!
Quote Reply
Re: [Troja] <%include <%user%>.txt%> problem In reply to
Does anyone get an answer to do something like the following in a template:

<%include <%somefile%>%>

Thanks!
Quote Reply
Re: [Fortune] <%include <%user%>.txt%> problem In reply to
Alex posted a global for this a while ago:

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

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [Fortune] <%include <%user%>.txt%> problem In reply to
A solution was given in another thread, just today I believe, with an explanation as to why it had to work that way.

The only way to do it, is to create a global that loads the file listed in the tag, parses it, and sends the parsed html back to the calling template.

You'd call it something like:

<%load_file filename_tag%>
<%parsed_return_file%>

Where parsed_return_file is the html returned from a call to the display routine, and load_file is the global that takes the filename in the filename_tag and attempts to load it, parse and then return it.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [yogi] <%include <%user%>.txt%> problem In reply to
Ivan, thanks so much! It works.
Quote Reply
Re: [Fortune] <%include <%user%>.txt%> problem In reply to
Hi,

I tried to do the same and loaded the dynamically created filename in the template global and returned the parsed html but the main html page does not show anything but blank space.
Is it the configuration of the web server which might be preventing it from being loaded cause i'am using the tags <!-- #include virtual="/path to the file/$filename" --> in the global template ?

regards
Kamal
Quote Reply
Re: [kamalrajm] <%include <%user%>.txt%> problem In reply to
Hi,

The output of your SSI call would be correct, but because its running through page.cgi, it doesn't get parsed as SSI (i.e its just a normal HTML page, and the code will just be shown, instead of the desired content). To run exteral "includes", you could try this global;

Code:
sub {
open (FILEREAD,$_[0]) || die qq{Can't read $_[0] . Reason: $!};
my @data = <FILEREAD>;
close (FILEREAD);
return join ("", @data);
}

Its not very advanced I'm afraid, but it should let you include pretty much any file, by just using;

<%global_name('/full/server/path/to/file.txt')%>

Hope that helps.

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] <%include <%user%>.txt%> problem In reply to
Thanks a lot andy, it works. :)