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?
Jun 30, 2001, 1:12 PM
User (320 posts)
Jun 30, 2001, 1:12 PM
Post #2 of 2
Views: 1212
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.
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.