Gossamer Forum
Quote Reply
All Links Output
Hi all,

Just thinking about a global that will output all links in the database on a page. This would do wonders for a sitemap type of page for search engines to spider.

--------------------------------
Privacy Software
Quote Reply
Re: [BLOOD] All Links Output In reply to
Also nice for users who want to capture all your links in your database Wink

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [BLOOD] All Links Output In reply to
Code:
sub {
require Links::SiteHTML;
my $output;
my $sth = $DB->table('Links')->select;
while (my ($rec) = $sth->fetchrow_hashref) {
$output .= Links::SiteHTML::display('link', $rec);
}
return $output;
}
Quote Reply
Re: [Paul] All Links Output In reply to
Thanks!

This look interesting, but stalls when building the page with that tag on.

It seems to be working hard doing something but never finishes.

all_links

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

--------------------------------
Privacy Software

Last edited by:

BLOOD: Mar 16, 2003, 11:20 AM
Quote Reply
Re: [BLOOD] All Links Output In reply to
Not sure this is a good idea - I have ex. 200k links - that page would not be worth loading nor producing... I would thing that it could even bring the server down..?

Klaus

http://www.ameinfo.com
Quote Reply
Re: [klauslovgreen] All Links Output In reply to
Not in your situation no, but as I have only about 150 speclist links and probably wont go over 300 so this should be ok.

--------------------------------
Privacy Software
Quote Reply
Re: [BLOOD] All Links Output In reply to
Hmm as far as I know that should be ok :(
Quote Reply
Re: [BLOOD] All Links Output In reply to
I made a global at some point that attempted to load all links owned by a user. A mistake in the code caused page.cgi to list all links of Admin - in my case 200,000 links - that brought the server to a halt...

But a few hundred should be fine I guess... perhaps you should put a lid on it - LIMIT 1000 :-)

Just my experience...

Cheers
Klaus

http://www.ameinfo.com

Last edited by:

klauslovgreen: Mar 16, 2003, 8:49 PM
Quote Reply
Re: [klauslovgreen] All Links Output In reply to
I tried the global that paul posted but I have the same problem as blood - basically the page never finishes loading.

All I want to do if have a list of the links (I only have 70 odd links) in one long list so the search engine siders can find everything easily on my sitemap.

Does any one have a global that works?

Thanks Alex



Indigo Clothing is a t-shirt printing company based in the UK.
Indigo Clothing | Promotional Clothing | T-Shirt Printing | Embroidery
Quote Reply
Re: [IndigoClothing] All Links Output In reply to
This is what I found and am using. Just adjust the
bottom <%all_links%>... section to suite your layout.


sub {
# Displays all links.
my $tags = shift;
my $table = $DB->table('Links');
$table->select_options ('ORDER BY Add_Date DESC');
my $sth = $table->select({ isValidated => 'Yes' });
my @output;
while (my $link = $sth->fetchrow_hashref) {

$link->{detailed_url} = "$CFG->{build_detail_url}/$link->{'ID'}$CFG->{build_extension}";
push (@output, $link);
}
return { All_Loop => \@output };
}


<%all_links%>
<%loop All_Loop%>
<a href="<%detailed_url%>"><%Title%></a> |
<%endloop%>

--------------------------------
Privacy Software
Quote Reply
Re: [BLOOD] All Links Output In reply to
Thanks for that. Smile

Suddenly realised that I waat to ouput static links rather than dynmaic ones. How would I change your global?

Alex



Indigo Clothing is a t-shirt printing company based in the UK.
Indigo Clothing | Promotional Clothing | T-Shirt Printing | Embroidery
Quote Reply
Re: [IndigoClothing] All Links Output In reply to
Ignore my last thread - I worked it out!

Alex



Indigo Clothing is a t-shirt printing company based in the UK.
Indigo Clothing | Promotional Clothing | T-Shirt Printing | Embroidery
Quote Reply
Re: [BLOOD] All Links Output In reply to
where do i add this code? or do i put it in a new page and call it for example all.cgi

In Reply To:
This is what I found and am using. Just adjust the
bottom <%all_links%>... section to suite your layout.


sub {
# Displays all links.
my $tags = shift;
my $table = $DB->table('Links');
$table->select_options ('ORDER BY Add_Date DESC');
my $sth = $table->select({ isValidated => 'Yes' });
my @output;
while (my $link = $sth->fetchrow_hashref) {

$link->{detailed_url} = "$CFG->{build_detail_url}/$link->{'ID'}$CFG->{build_extension}";
push (@output, $link);
}
return { All_Loop => \@output };
}


<%all_links%>
<%loop All_Loop%>
<a href="<%detailed_url%>"><%Title%></a> |
<%endloop%>
Quote Reply
Re: [theguy] All Links Output In reply to
The sub { ... } part is a global. To add this go to admin->build->template globals and past it into the large blank box at the bottom of the list. In the small blank box put all_links

Then decide on which page you want to show the list of links. Wherever it is that you want to display the list, paste

<%all_links%>
<%loop All_Loop%>
<a href="<%detailed_url%>"><%Title%></a> |
<%endloop%>

into the template. Obviously if you want this on a new page, you will need to create a new template. You can then display the new template using /cgi-bin/page.cgi?p=newtemplate where newtemplate.html is your new template.
Quote Reply
Re: [afinlr] All Links Output In reply to
How would you List an Alphabetical listing? I don't want to sort by add date
Jason Bishop

Quote Reply
Re: [netnow] All Links Output In reply to
Try changing

'ORDER BY Add_Date DESC'

to

'ORDER BY Title DESC'
Quote Reply
Re: [afinlr] All Links Output In reply to
Yeah I tried that and it doesn't work? It seems to me that it would work. anything else?
Jason Bishop

Quote Reply
Re: [afinlr] All Links Output In reply to
SOrry, I fee like an idiot

It should be:
'ORDER BY Title'

not desciption

Thank you for your help
Jason Bishop