Gossamer Forum
Home : Products : Gossamer Links : Discussions :

New template -- Dynamic Mode

Quote Reply
New template -- Dynamic Mode
Dear all,

I tired to use page.cgi to display a custom template.

I use the following link to call the template:

/cgi-bin/page.cgi?ID=<%ID%>&p=custom&t=someset&d=1

p = template file name
t = template set

After I call this page, it just can't show all information, including Site Title, add date, rating...... I also added some custom fields in my database but it also can't be shown.

I would like to know, how can I make page.cgi to show all the database information in a custom template?

Any help is apprecipated.

Thanks :-)

Quote Reply
Re: New template -- Dynamic Mode In reply to
Do you have a full URL to see what it's doing?

PUGDOGŪ Enterprises, Inc.
FAQ:http://LinkSQL.com/FAQ
Forum:http://LinkSQL.com/forum
Quote Reply
Re: New template -- Dynamic Mode In reply to
Sorry Pugdog,

I am just testing it on my local server. Can the page.cgi show all information available in the database?

Quote Reply
Re: New template -- Dynamic Mode In reply to
ummm ....

simple question here.

what happened to the links that let you change between the templates?

in 2.0.3 there were links that let you flip between the template sets. This was nice just to see how the other versions would look like. I'm still getting used to LinksSql on my home box.

but I'm happy to see how the templates could be called from the above link. I browsed through the documentatin but I didn't see this ... well, it was about 3am when I was reading.

cheers

Quote Reply
Re: New template -- Dynamic Mode In reply to
hmm I think you should link on this way:
page.cgi?p=customtemplate&ID=<%ID%>&t=customtemplateset

that works on my system.


Quote Reply
Re: New template -- Dynamic Mode In reply to
Doesn't work on mine.
Here's what I do:
Copy detailed.html to andy_c.html
type in
page.cgi?p=andy_c&ID=1&t=default

and I get:

Unknown Tag: 'title'
Unknown Tag: 'Description'
Submitted by: Unknown Tag: 'LinkOwner'
Hits: Unknown Tag: 'Hits'

and that's on the latest install. Any ideas?

Quote Reply
Re: New template -- Dynamic Mode In reply to
hmm

your template andy_c.html
does not have any reference, so your globals are unknown.
the easiest way of this is:

copy the folowwing subroutine in Links/Utils.pm

sub link_info {
# -------------------------------------------------------------------
# You call this tag by placing <%Links::Utils::link_info%> in your templates
#
#
my $tags = shift;
my $link_db = $DB->table('Links');
my $id = $tags->{ID};
my $link_info = $link_db->get($id, 'HASH');
return $link_info;
}

and paste the folowwing in your new template

<%Links::Utils::link_info%>

<%ID%>
<%Title%>

and more globals thet refers from the links table.

hope it works.






Quote Reply
Re: New template -- Dynamic Mode In reply to
Go to: http://www.sstreams.com/cgi-bin/links/page.cgi?g=Detailed/1530.shtml&t=sstad&d=1

All the information about the link is displayed on this page. The template is exactly the same as the one I use for the static version of the directory.

Does your template work on static pages?

Quote Reply
Re: New template -- Dynamic Mode In reply to
Hi,

Thanks for the help. I can't really test anything out at the moment, but I should do the trick.

Many thanks.

Quote Reply
Re: New template -- Dynamic Mode In reply to
Hi,

I think it was explaind earlier in this thread but the problem is:

page.cgi?p=custom_template

just loads and parses custom_template.html. If you go to:

page.cgi?p=custom_template&ID=123

you will have the tag <%ID%> available, but not the other link columns. You must load the link for these to be available. You will only have available CGI input and the globals.

To load the link, see ridesworld post about link_info tag.

Cheers,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: New template -- Dynamic Mode In reply to
Hi,
This no longer works with the new version. Any ideas why?

Quote Reply
Re: New template -- Dynamic Mode In reply to
Polite bump.

Quote Reply
Re: New template -- Dynamic Mode In reply to
Hi,

Before you get to the impolite bump Smile....

I think in the US/Canada it is some sort of holiday so I think that is why the GT guys aren't about. They are also busy working on something very cool.

- just thought I'd let you know Alex isn't ignoring you.

Mods:http://wiredon.net/gt/download.shtml
Installations:http://wiredon.net/gt/
Quote Reply
Re: New template -- Dynamic Mode In reply to
Hi,

Yes, we changed how function calls get their arguments in the template system. If you put:

<%Links::Utils::link_info%>

The first argument to link_info() was the template tags. As of 2.0.4, that was changed so it does not get passed any special arguments. To get the template tags, you must do:

my $tags = GT::Template->tags;

However, a better solution is to move that into a global as it will be safer during upgrades. If you add a global:

link_info =>
Code:
sub {
my $tags = shift;
my $link_db = $DB->table('Links');
my $id = $tags->{ID};
my $link_info = $link_db->get($id, 'HASH');
return $link_info;
}
and then just use <%link_info%> instead it will work.

Cheers,

Alex


--
Gossamer Threads Inc.