Gossamer Forum
Skip to Content



Home : Products : Gossamer Links : Development, Plugins and Globals :

Ultra Globals, Users_Listings

Quote Reply
Ultra Globals, Users_Listings
I have a main listing with the URL as a hook to other attached documents to that listing.
Say the detailed.html is a person, with the URL defined as 12345. That person has other associated files, also built separately with detailed.html but linked within each other with a search specificly "12345". This URL is unique to each person.
Then I display a link on the persons detailed.html which does a search to 12345, and in the regular search form everything asociated with "12345" is displayed.

Perhaps, using this code, I can instead of linking to the LinkOwner, we can get files that belong to URL12345.
Using the Contact_Name would be just as good.

Possible?

Thanks,

Juan Carlos




Code:
# Users_Listings[/url]
This global will get a list of the users links, and also separately the links ordered by rating, and also by hits.
<%Plugins::ULTRAGlobals::Users_Listings($LinkOwner)%>
..or to get as list of links owned by the current logged in user, use:
<%Plugins::ULTRAGlobals::Users_Listings($LinkOwner)%>
Then, in the template (after the above code) - you can use:
<h2>Users Links</h2>
<%if user_links.length%>
<%loop user_links%>
<%include link.html%>
<%endloop%>
<%else%>
<p>No links.</p>
<%endif%>

<h2>Users Links By Hits</h2>
<%if user_links_by_hit.length%>
<%loop user_links_by_hit%>
<%include link.html%>
<%endloop%>
<%else%>
<p>No links.</p>
<%endif%>

<h2>Users Links By Rating</h2>
<%if user_links_by_rating.length%>
<%loop user_links_by_rating%>
<%include link.html%>
<%endloop%>
<%else%>
<p>No links.</p>
<%endif%>

Quote Reply
Re: [Gorospe] Ultra Globals, Users_Listings In reply to
Hi,

Ok, I'm not 100% sure what you mean here. Are you saying (for example), a user has a URL of 12345 - and they also have several other listing with the same URL (and you want to get the listings, something like WHERE URL = 1234) .. is that right?

Cheers

Andy (mod)
andy@ultranerds.com


Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Custom Toolbar for IE and Firefox! - Compare our different Plugin packages *new*
Free CSS Templates
Quote Reply
Re: [Andy] Ultra Globals, Users_Listings In reply to
Yeah, I think you got it. The common denominator between them is the URL field or the Contact_Name field.

JC
Quote Reply
Re: [Gorospe] Ultra Globals, Users_Listings In reply to
Hi,

Untested, but try:

users_listings
Code:
sub {

my $user1 = $_[0];

# normal links
my $link_db = $DB->table ('Links');
$link_db->select_options ('ORDER BY ID DESC','LIMIT 3') || die $GT::SQL::error;

my $sth = $link_db->select( { isValidated => "Yes", URL => $user1] } ) || die $GT::SQL::error;

my @links;

# just normal links.
while (my $link = $sth->fetchrow_hashref) {
$link->{detailed_url} = $CFG->{build_root_url} . "/" . $DB->table('Links')->detailed_url( $link->{ID} );
push @links, $link;
}

# ratings
my $link_db = $DB->table ('Links');
$link_db->select_options ('ORDER BY Rating DESC', 'LIMIT 10') || die $GT::SQL::error;

my $sth = $link_db->select( { isValidated => "Yes", ID => $user1 } ) || die $GT::SQL::error;

my @links2;
# just top rated links.
while (my $link = $sth->fetchrow_hashref) {
$link->{detailed_url} = $CFG->{build_root_url} . "/" . $DB->table('Links')->detailed_url( $link->{ID} );
push @links2, $link;
}

# ratings
my $link_db = $DB->table ('Links');
$link_db->select_options ('ORDER BY Hits DESC', 'LIMIT 10') || die $GT::SQL::error;


my $sth = $link_db->select( { isValidated => "Yes", ID => $user1 } ) || die $GT::SQL::error;

my @links3;
# just top rated links.
while (my $link = $sth->fetchrow_hashref) {
$link->{detailed_url} = $CFG->{build_root_url} . "/" . $DB->table('Links')->detailed_url( $link->{ID} );
push @links3, $link;
}

return { user_links => \@links , user_links_by_hit => \@links3, user_links_by_rating => \@links2 }

}

...call with:

Code:
<%users_listings($URL)%>
<%if user_links.length%>
<%loop user_links%>
<%include link.html%>
<%endif%>
<%endif%>

(etc)

Untested, but should work fine =)

Cheers

Andy (mod)
andy@ultranerds.com


Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Custom Toolbar for IE and Firefox! - Compare our different Plugin packages *new*
Free CSS Templates
Quote Reply
Re: [Andy] Ultra Globals, Users_Listings In reply to
Im getting the following error on the page:

Unable to compile 'users_listings': syntax error at (eval 39) line 9, near "$user1]" Global symbol "$sth" requires explicit package name at (eval 39) line 14. Global symbol "$user1" requires explicit package name at (eval 39) line 23. Global symbol "$user1" requires explicit package name at (eval 39) line 37. Unmatched right curly bracket at (eval 39) line 48, at end of line syntax error at (eval 39) line 48, near "} }"
Quote Reply
Re: [Gorospe] Ultra Globals, Users_Listings In reply to
Sorry - was a typo - serves me right for trying to reply pissed :P

Change:

my $sth = $link_db->select( { isValidated => "Yes", URL => $user1] } ) || die $GT::SQL::error;

...to:

my $sth = $link_db->select( { isValidated => "Yes", URL => $user1 } ) || die $GT::SQL::error;

Hopefully that will sort it =)

Cheers

Andy (mod)
andy@ultranerds.com


Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Custom Toolbar for IE and Firefox! - Compare our different Plugin packages *new*
Free CSS Templates
Quote Reply
Re: [Andy] Ultra Globals, Users_Listings In reply to
Worked great!

Thank you Andy
Quote Reply
Re: [Gorospe] Ultra Globals, Users_Listings In reply to
Hmm spoke too soon... Workes great in dynamic mode.... but doesnt work in static.
Its missing the directory where files are built in.

Sample should be: http://www.site.com/detailed/something/other/page_1234.html
Its building: http://www.site.com/something/other/page_1234.html

So all links are broken. Doesnt happen in dynamic only in static.

Any ideas?
Here is my loop:

Code:
<%users_listings($URL)%>
<%if user_links.length%>
<ul style="text-align: left">
<%loop user_links%>
<li><%include link.html%></li>
<%endloop%>
</ul>
<%endif%>


Here is the global:

Code:
sub {

my $user1 = $_[0];

# normal links
my $link_db = $DB->table ('Links');
$link_db->select_options ('ORDER BY ID DESC','LIMIT 300') || die $GT::SQL::error;

my $sth = $link_db->select( { isValidated => "Yes", URL => $user1 } ) || die $GT::SQL::error;

my @links;

# just normal links.
while (my $link = $sth->fetchrow_hashref) {
$link->{detailed_url} = $CFG->{build_root_url} . "/" . $DB->table('Links')->detailed_url( $link->{ID} );
push @links, $link;
}

# ratings
my $link_db = $DB->table ('Links');
$link_db->select_options ('ORDER BY Rating DESC', 'LIMIT 10') || die $GT::SQL::error;

my $sth = $link_db->select( { isValidated => "Yes", ID => $user1 } ) || die $GT::SQL::error;

my @links2;
# just top rated links.
while (my $link = $sth->fetchrow_hashref) {
$link->{detailed_url} = $CFG->{build_root_url} . "/" . $DB->table('Links')->detailed_url( $link->{ID} );
push @links2, $link;
}

# ratings
my $link_db = $DB->table ('Links');
$link_db->select_options ('ORDER BY Hits DESC', 'LIMIT 10') || die $GT::SQL::error;


my $sth = $link_db->select( { isValidated => "Yes", ID => $user1 } ) || die $GT::SQL::error;

my @links3;
# just top rated links.
while (my $link = $sth->fetchrow_hashref) {
$link->{detailed_url} = $CFG->{build_root_url} . "/" . $DB->table('Links')->detailed_url( $link->{ID} );
push @links3, $link;
}

return { user_links => \@links , user_links_by_hit => \@links3, user_links_by_rating => \@links2 }

}

anyone see where its missing something?

Thanks,

Juan Carlos
Quote Reply
Re: [Gorospe] Ultra Globals, Users_Listings In reply to
Hi,

Please change instances of:
Code:
$CFG->{build_root_url}

..with:

Code:
$CFG->{build_detail_path}

That should sort it =)

Cheers

Andy (mod)
andy@ultranerds.com


Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Custom Toolbar for IE and Firefox! - Compare our different Plugin packages *new*
Free CSS Templates
Quote Reply
Re: [Andy] Ultra Globals, Users_Listings In reply to
Hmmm not working... its added the actual linux full pwd path, plus the http path.. very funky..
Ill PM you a URL so you can see it.

Thanks Andy.
Quote Reply
Re: [Gorospe] Ultra Globals, Users_Listings In reply to
Sorry, I mean't:

$CFG->{build_detail_url}

...not

$CFG->{build_detail_path}

Been a loooong day =)

Cheers

Andy (mod)
andy@ultranerds.com


Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Custom Toolbar for IE and Firefox! - Compare our different Plugin packages *new*
Free CSS Templates
Quote Reply
Re: [Andy] Ultra Globals, Users_Listings In reply to
Worked great Andy.

Thanks

Juan Carlos