Gossamer Forum
Quote Reply
Users links global
Hi

I trying to make a global that will return the links those a given user have added..?

I have created a Users page and trying to add a list of the users links..
Regards
KaTaBd

Users plug In - Multi Search And Remote Search plug in - WebRing plug in - Muslims Directory
Quote Reply
Re: [katabd] Users links global In reply to
Code:
sub {
my $output;
my $sth = $DB->table('Links')->select( { LinkOwner => $USER->{Username} } );
while (my $rec = $sth->fetchrow_hashref ) {
$output .= Links::SiteHTML::display('link', $rec );
}
return $output;
}
Quote Reply
Re: [Paul] Users links global In reply to
Hey Paul

What will be the approach to forec this global to use a secondary link.html templete like link_code.html?
Regards
KaTaBd

Users plug In - Multi Search And Remote Search plug in - WebRing plug in - Muslims Directory
Quote Reply
Re: [katabd] Users links global In reply to

Hi KaTaBd,

Just replace the

$output .= Links::SiteHTML::display('link', $rec );

with

$output .= Links::SiteHTML::display('link_code', $rec );

Laura.


The UK High Street
Quote Reply
Re: [katabd] Users links global In reply to
Hi,

Yes Laura is correct.

'link' is just the template name so you may replace it with whatever you like as long as the template exists.
Quote Reply
Re: [afinlr] Users links global In reply to
Thanks both..

i will try that when i get back home..
Regards
KaTaBd

Users plug In - Multi Search And Remote Search plug in - WebRing plug in - Muslims Directory
Quote Reply
Re: [Paul] Users links global In reply to
I understand that the following global will return the links owned by a particular user.

sub {
my $output;
my $sth = $DB->table('Links')->select( { LinkOwner => $USER->{Username} } );
while (my $rec = $sth->fetchrow_hashref ) {
$output .= Links::SiteHTML::display('link', $rec );
}
return $output;
}

What I need, however, is a global that will simply/only return the total number of entries that the logged-in user has in the database. After weeks of attempts, I'd really appreciate it if someone could share a global to do this. Thanks so much in advance!
Quote Reply
Re: [kysa] Users links global In reply to
It's a simple change:

Code:
sub {
return $DB->table('Links')->count( { LinkOwner => $USER->{Username} } );
}
Quote Reply
Re: [Paul] Users links global In reply to
wow... fast & easy... thanks very much!!
Quote Reply
Re: [kysa] Users links global In reply to
Is there any way to sort it to display top 10 users submitting links?

Last edited by:

Kay: Apr 3, 2003, 4:55 AM
Quote Reply
Re: [Paul] Users links global In reply to
HI There,

I tried both of these versions of globals, they aren't working for me, could this be becasue I am placing them on detailed.html templates?
Quote Reply
Re: [SSmeredith] Users links global In reply to
If using static dynamic pages, then yeah, it will be your problem. Are you using static or dynamic?

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] Users links global In reply to
HI Andy, yes static this time around
Quote Reply
Re: [SSmeredith] Users links global In reply to
In that case, because $USER->{Username} is defined in real time (i.e when the page itself is built), when doing it via Admin it obviously doesn't pass that variable into the global (because as far as the script is concerened, it doesn't know if you are logged in or not).

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] Users links global In reply to
Hi Andy,

u mean only when that particular user add the script, the global will then display the other link he added?
Quote Reply
Re: [gundamz] Users links global In reply to
Hi all,

This global doesn't seem to work. Any ideas on how to fix it?
Quote Reply
Re: [gundamz] Users links global In reply to
I believe what Andy is saying is that this global only functions properly when viewed through one of the cgis such as page.cgi. In static mode, when people are browing the site with just the "html" files, since the file are all generated beforehand there is no ability for the html to know at viewing time what links the user has added or owns.

It is possible for links sql to generate php pages which are dynamic, unlike the html pages, which can detect the status of login of the user and then pull up the appropriate information but I don't know offhand how to do this (as I do not code php ;)
Quote Reply
Re: [Aki] Users links global In reply to
Any solution for pple that used static page?
Quote Reply
Re: [gundamz] Users links global In reply to
Yeah, you can add in a include.

the include pulls in a .txt page.

And THAT page, has a include virtual running the search/cgi.

Andy does not use static mode often.

So basically, loading the static html page makes a dynamic process run - easy.

or the static page has the include directly...
Quote Reply
Re: [gundamz] Users links global In reply to
A few months ago we worked out a global for this, and I run it on the logon page. It shows the number of links a user has, and can return the links a user has by changing the routine slightly. It's been posted to the forum, somewhere (there are many threads on this topic).

If you just want to show a user their links as a reminder, then login_success.html is a dynamically generated page in any installation, so it would work in static or dynamic. After they log in, just have a display with their current links, pending links, etc.

If you want to show the users links in static mode, then you could provide a link to a small script that would display their links. Basically move the global to a .cgi file (with the proper headers -- as in jump.cgi or search.cgi) and you'll have a way to show a user their links.

To show the links inside a "static" page, you'd have to use SSI or includes, as mentioned above.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.