Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Include files

Quote Reply
Include files
Hello.

I have put in all my categories a specific file. The name of this file is file.txt.

Example:
Home/Food/file.txt
Home/Food/Meat/file.txt
Home/Food/Meat/Shops/file.txt

Now I want include all file.txt in her specific category.
I tried this:

<%include /path/to/linkssql/Home/Food/file.txt%>

My problem is, that the path is changing in any category.
Is there a way to change the path dynamically?



Or is it possible to call the file with the ID?
When I would put all txt files in a separate folder,
give them the name of the ID and call them with:

<%include /path/to/linkssql/folder-wherer-txt-files-are-stored/<%ID%>.txt%>



Knubbel

Last edited by:

Knubbel: Jul 29, 2008, 11:23 PM
Quote Reply
Re: [Knubbel] Include files In reply to
Doing it with something like this would make more sense (as it keeps them all in one folder);

<%include /path/to/linkssql/folder-wherer-txt-files-are-stored/$ID.txt%>

If that doesn't, then a global would do the same thing.

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 files In reply to
Yes, you 're right.

I tried it. $id shows not the id-number.

It shows only:
/$id.txt
Quote Reply
Re: [Knubbel] Include files In reply to
Hi,

Try it with a simple global then:

load_file_from_id
Code:
sub {
my $path = '/path/to/folder' . $_[0] . '.txt';
my $back;
open(READIT,$path) || return qq|can't read $path, reason: $!|;
while (<READIT>) { $back .= $_; }
close(READIT);
return $back;
}

..then call with:

<%load_file_from_id($ID)%>

Should work fine Smile

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!

Last edited by:

Andy: Jul 30, 2008, 12:19 AM
Quote Reply
Re: [Andy] Include files In reply to
I tested it.

When I call this it only shows the (correct) path. But it does not include.
<%load_file_from_id($ID)%>
Quote Reply
Re: [Knubbel] Include files In reply to
Sorry, please try the modified version. I had:

return $path

instead of

return $back

Blush

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 files In reply to
It works fine...

Thanks, Knubbel.