I did something similar before. I can't find the link for it now though :(
This is how I did it;
1) Add a new template, called "user_details". On this template, add a global called "grab_users_details";
my $user = $_[0];
# just check we have a username passed, and that
# it isn't the admin one...
return if $user eq 'admin';
return if !$user;
# setup our array
my @links;
# grab the users links :)
my $sth = $DB->table('Links')->select( { LinkOwner => $user } )
|| return $GT::SQL::error;
while (my $hit = $sth->fetchrow_hashref) {
push @links, $hit;
}
$links[0] ? return { users_links => \@links } : return;
}
You then need to put this on the template;
<%if user_links%>
<%loop user_link%>
<%include link.html%><BR>
<%endloop%>
<%endif%>
Then, just call it via;
http://www.yoursite.com/cgi-bin/page.cgi?p=user_details&user=myusername
Hope that helps (its all untested, as I'm just doing this from memory... apologies if it doesn't work right away).
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!
This is how I did it;
1) Add a new template, called "user_details". On this template, add a global called "grab_users_details";
Code:
sub { my $user = $_[0];
# just check we have a username passed, and that
# it isn't the admin one...
return if $user eq 'admin';
return if !$user;
# setup our array
my @links;
# grab the users links :)
my $sth = $DB->table('Links')->select( { LinkOwner => $user } )
|| return $GT::SQL::error;
while (my $hit = $sth->fetchrow_hashref) {
push @links, $hit;
}
$links[0] ? return { users_links => \@links } : return;
}
You then need to put this on the template;
Code:
<%grab_users_details($user)%> <%if user_links%>
<%loop user_link%>
<%include link.html%><BR>
<%endloop%>
<%endif%>
Then, just call it via;
http://www.yoursite.com/cgi-bin/page.cgi?p=user_details&user=myusername
Hope that helps (its all untested, as I'm just doing this from memory... apologies if it doesn't work right away).
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!