Gossamer Forum
Quote Reply
[bug fix] ALPHA BAR
Hi,

Found a bug that I don't know how I missed (maybe I'm using an older copy?)

Anyway, easy to fix in Alpha_Bar.pm:

Code:
my $cond = GT::SQL::Condition->new ( $search_field, 'LIKE', $query, 'isValidated', 'LIKE', 'Yes' );


The condition element needs a second condition, to only return validated links. As it was, it was returning all links.

You can also use this idea to create a more restrictive, or limited return set, if you need to.

Just add the part in red to the line, making sure to not forget the ','


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] [bug fix] ALPHA BAR In reply to
Hmm shouldn't it be:

my $cond = GT::SQL::Condition->new ( $search_field, 'LIKE', $query, 'isValidated', '=', 'Yes' );
Quote Reply
Re: [Paul] [bug fix] ALPHA BAR In reply to
Could be ... I thought about '=' but with the luck I've been having, "LIKE" will find "yes" "Yes" and "YES", and that, biggest thing, is _not_ "LIKE" "NO" <G>


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] [bug fix] ALPHA BAR In reply to
Does the Alpha bar plugin work with <%loop link_results_loop%> tag? I can't seem to get it to show results that way.

If not, is there something in the Alpha_Bar.pm that could be changed to support loops?

Thanks,

Bryan
Quote Reply
Re: [BryanL] [bug fix] ALPHA BAR In reply to
Hi,

I think this pre-dates the loop support :)

This was one of the nastiest programs I tried to write, and like a mythical snake creature, it changed form a dozen times before release. I've kind of left it alone because of that.

I'm in the process of cleaning up, updating, and porting most of my released code, programs, and snippets to one "Utility" plugin. You'll get the detailed_page, Days_Old, Updated_Search_Logger, top searches/keywords, modified Yahoo Cats, bad_link, recommend_it, file upload, logo, etc and others in one easy to install plugin, with a library of routines in the Plugins::PUGDOG directory you can call as needed (or ignore).

I'll probably have a free version that is missing the file and logo handling, and contains the stuff I've released in the forums, the downloads area, and more. The paid version will include the file/upload/logo handling. Probably $45. I will update both the free and paid versions with new snippets and such as I write them.

I should have it ready this month, or early next. It will also include many globals I've written over the years, and other odds and ends, all in one place. It's more for my own use, and organization, than anything. :)

I've started to put my stuff into functions/modules that can be called from inside the templates

<%Plugins::PUGDOG::Days_Old%>

for example. Unlike globals, they are not tiggered unless you need/want them. Alex has said processing hits are negligible for these sorts of calls, and while not timing them out, it seems to be true. The database call is the major time waster, beyond that, the rest of the template parsing goes very quickly.

For instance, the Days_Old call is only needed in the link.html template, and perhaps detailed.html depending on your site. Why waste any tests at all on it, unless needed?

So, the point is that I will be looking at the Alpha_Bar for cleanup and insertion into this module system. There is probably a *lot* I can clean up given the time/experience that has gathered since this snake's original release ;)

For those not in the know, so to speak <G> The Alpha_Bar started out as a program to generate a linked alpha_bar on a page. What it turned out to be, is a way to hook into the search_a_column feature of links, using either a _start_of_word_ search, or a _containing_ search of *any* number of characters:

a, an, ang, ange, angels, etc.

without interfering with the regular search system. It was template controlled, so actually, you could alter it's behavior on different pages by passing in a different search column.

For instance, on my IdentityDots.com site, I wanted people to be able to search for domain names that either started with, or contained a letter or string of characters.

It's worked for that.... so I've left it alone <G>

Adding in loop support *should* be mostly a cut/paste procedure.

In the .pm file, try changing:

# And format the link results.
my ($link_results, %link_output, @link_results_loop); ## add/change this
if ($link_count) {
while (my $link = $link_sth->fetchrow_hashref) {
$link_results .= Links::SiteHTML::display('link', $link);
push @link_results_loop, $link; ## add this
}
}

......


# Print the output.
$opts->{link_results} = $link_results;
$opts->{link_results_loop} = \@link_loop; ## add this
$opts->{link_hits} = $link_count;
$opts->{cat_hits} = 0;
$opts->{next} = $toolbar;


That should be all that is needed ie: create the return array, return the array.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] [bug fix] ALPHA BAR In reply to
In Reply To:

# Print the output.
$opts->{link_results} = $link_results;
$opts->{link_results_loop} = \@link_loop; ## add this

Works like a charm, thanks! There is one small error in your code: $opts->{link_results_loop} = \@link_loop; should be $opts->{link_results_loop} = \@link_results_loop;

I'm planning on using it as a simple alphabet bar where users can click on a letter and every link that starts with that letter is displayed. Supporting loops means that it's much easier to display the results a little differently than the standard directory pages.

Bryan
Quote Reply
Re: [BryanL] [bug fix] ALPHA BAR In reply to
If you are using the loop you should remove:

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

....otherwise you will be parsing loads of templates without any need :)