Gossamer Forum
Home : Products : Gossamer Links : Discussions :

make another table's fields available in global

Quote Reply
make another table's fields available in global
How could I make a table that's not belong to LinkSQL but ib the same database, to make it's data available in template globals?

Quote Reply
Re: make another table's fields available in global In reply to
try to create something like this:
In this case, I have table called review with a primary key called Review_ID:


sub review_info {
my $tags = shift;
my $review_db = $DB->table('Review');
my $id = $tags->{Review_ID};
my $review_info = $review_db->get($id, 'HASH');
return $review_info;
}

I have paste it in a pm file called Option.pm and add the globals in the templates like:

<%Links::Options::review_info%>
<%Review_ID%>
<%Review_Title%>

You can do this also with your tables in the same database, this is also an easie way to connect data from other applications that use the same database.