Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

Sorting ASC Problem

Quote Reply
Sorting ASC Problem
I am trying to sort links in ascending order based upon a number I place in a new field called 'Priority'. My Links.def file includes the following for this field:

Priority => ['17', 'INT', '10', '20', '1', '10', '^\d*\.?\d*$'],


and my Links.PM sorting has been modified to:

# The default sort orders for links.
$LINKS{build_sort_order_category} = "Priority ASC,isNew";
$LINKS{build_sort_order_new} = "Add_Date,Title";
$LINKS{build_sort_order_cool} = "Title";
$LINKS{build_sort_order_search} = "Priority ASC,isNew";


Despite this, in some categories the links are not always placed in the ascending order I would expect. In other words sometimes a link with a 'Priority' field value of 9 will be placed above a link with a 'Priority' field of 3.

Is there something that I am forgetting to do here?

Any help would be very much appreciated!

-FM
Quote Reply
Re: Sorting ASC Problem In reply to
Sorry! Upon further checking on this problem, I saw there were some threads that note that Links SQL has a bug when sorting and using the Alternate categories...

Does anyone know if any fix been made for this yet?

It's absolutely critical for my site that I can sort the links on the category pages.

Is the only immediate solution to not use the Alternate categories? (I'm really, truly hoping that I don't have to go and re-do hundreds of links that are placed in more than one category...)

Help please!

-FM
Quote Reply
Re: Sorting ASC Problem In reply to
Hello,

it would be very nice if someone can solve this problem, because it's nearly the same at my directory...:

I want to sort by ratings (regular and alternate entries) and it sorts NOT correctly...

Thanks in advance for help,

DMK-Support
Marcus Lutz

------------------
Musichits - the big music-search-engine including hit-counter and ratings:
http://www.musichits.org/
The Real Top 500 Music-sites
http://www.musichit.org/top/
Quote Reply
Re: Sorting ASC Problem In reply to
It's not so easy... it affects all the build routines, actually, and needs to be done in a centralized way. Hopefully Alex is addressing this for the next update.

As posted, the "hack" is to use a temporary table, take the two "select" statements and insert them into that table, then perform the sort on that table.

The other way, was to re-think the way alternate categories are stored -- and Alex wasn't sure which he was going to do.



------------------
POSTCARDS.COM -- Everything Postcards on the Internet www.postcards.com
LinkSQL FAQ: www.postcards.com/FAQ/LinkSQL/








Quote Reply
Re: Sorting ASC Problem In reply to
Thanks for the insight. I can see how this would be a tricky problem to correct. In the meantime I'm stuck...

If I go through my database and remove all of the alternate categories, could I assume that it will then sort correctly based on a custom field called 'Priority' as noted at the top of this thread?

If so, does anyone know the SQL command to enter in the SQL Monitor that would empty out the Alternate Category table data?

I really need to get some kind of fix to this problem as soon as possible, and would appreciate any comments on whether this will work to solve the custom sorting, by not using alternate categories. Thanks!

-FM

Quote Reply
Re: Sorting ASC Problem In reply to
You might try:

DELETE * FROM CategoryAlternates

That's off the top of my head... What that will do is remove all the alternates, and I'd suggest a re-index and rebuild (just in case).

If you think you would want the category alternates again, then the best thing to do would be to copy that table to another table, then erase the CategoryAlternates table as above.

If you have PHP3 installed, the PHPAdmin program makes it _trivial_ to do -- just a couple of clicks.

I'm liking PHP more and more, and see it as the way to add dynamic content to the site overcoming the limitations of SSI and pure CGI. Once I figure out some logical plans I'll have some suggestions here and in the FAQ. Right now I'm proxying the PHP3 and mod_perl to the back-end server. (I couldn't figure out how to proxy *.php3 -- in fact, no one I contacted could figure it out ...., so what I did was put all the php programs into a separate tree on the server, and everything in the /PHP/ is now proxy'd to the back end server. This way, static HTML is served up from the front end, but anything needed processing is passed to the back end. .htm, .html, etc is front end, /perl/ and /php/ are back end. PHP3 will also make integration of advertising much easier than perl-based scripts -- with significantly more power than SSI.)
Quote Reply
Re: Sorting ASC Problem In reply to
pugdog, you might want to stop by the FutureQuest forums at http://www.aota.net/cgi-bin/Ultimate.cgi . I host my sites with FutureQuest, and support could not possibly be any better. More importantly though, the tech/admin people and many of the customers are die-hard PHP supporters that are quite knowledgeable and helpful in that and other areas. Several of them use PHP nearly exclusively in place of Perl. It's an open forum to non-customers, so you would be most welcome to bounce ideas off people.

Dan
Quote Reply
Re: Sorting ASC Problem In reply to
Hi Pugdog,

Ack, not going to lose you to PHP am I? =) If you want that type of environment (i.e the html page is the application), you may want to look at Apache::ASP or Embperl. I've played with Apache::ASP, and it is pretty nice.

As for proxying php requests, you should be able to do it with mod_rewrite without too much difficulty. Something like:

RewriteEngine on
RewriteCond %{REQUEST_URI} \.php
RewriteRule ^/(.*) http://localhost:81/$1 [P]

What that says is if the requested url matches .php, then proxy it to the server running on port 81. I've done something very similiar to proxy requests for .cgi to a backend server, so .php shouldn't be any difference.

You just need to make sure that the backend server has the same document root as the front server, so that /foo/something.php is the same file on both servers.

Cheers,

Alex
Quote Reply
Re: Sorting ASC Problem In reply to
No... You aren't going to lose me to PHP ... PHP is a "scripting" language, and it allows for "active" pages to a larger degree than SSI does -- and without the penalty (apparantly) if you don't count the bloated apache Smile

But, rather than having Links generate .html or .shtml pages, I think a combination of .php3 pages, to cut the "build" time for the static pages (I know this is an oxymoron here, but ...) Rather than generate a huge site dynamically, which would require a lot of database processing, and penalty that could be done _once_ during a nightly or even weekly build session (or in the case of a truly large site... continuously) PHP would add to the static pages data that changes on each page load -- such as advertising, site statistics, news clips, etc.

I don't think the two are mutually exclusive. The more I read, and play with the servers, perl, PHP, etc the more I see no one solution can do it all.

In searching for a shopping cart, forum program, and advertising program, the current limitations don't allow for real integration. Most of what is out there _sucks_ (pardon, but that _is_ toned down).

As for Apache::ASP or Embperl, embperl I don't think is "there" yet. I'll check it again, but last time I looked, it was still pretty developmental and "bleeding edge" for production environments. As for "ASP" -- I don't want to use anything that reminds me of M$ <G>..... but I'll check it out, since I haven't really evaluated it yet.

What is needed, is a way to generate a site, with a combination of static and dynamic pages. If certain page data doesn't change very often, then _that_ could be stored in an SQL database, but generated ahead of time, while the parts of the page that change, can be requested on each access. This cuts the processing load -- especially of redundant non-changing requests.

I may be all wrong in this, but I'm looking at developing a very large site -- if not in the pure number of links, in the number of fields, tables and data relations that have to be handled.

At my current load, I could do pure dynamic, but as I follow the growing pains of sites like ebay -- the need for pre-generation of the "templates" (if you will) is more important, filling in only the data that really needs to be there.

If Links generates the php pages, (or other script pages) then it does most of the work as a "program" (perl is in that in-between realm - like BASIC) to generate the individual templates (each link would essentially be it's own custom template).

When that page is then requested, rather than using page.cgi to generate all the data, and figure everything out, the scripting language would just "fill in the blanks" left by the nph-build.cgi

Then, this would allow dynamic linking of advertising, shopping and other add-ins, such as context-sensitive or time-sensitve content without rebuilding the whole site.

It's all still experimental on my end -- but PHP has shown it's utility in the Admin program, and there are some nice PHP add-ins that would solve a lot of problems -- at least in the short term -- many people have in site development with pure perl.

[[Basically, I'm stressing, since I have major server/domain/etc upgrades in progress, and I'm trying to figure a way to integrate it all without it becoming an administrator nightmare]]


------------------
POSTCARDS.COM -- Everything Postcards on the Internet www.postcards.com
LinkSQL FAQ: www.postcards.com/FAQ/LinkSQL/










[This message has been edited by pugdog (edited February 16, 2000).]
Quote Reply
Re: Sorting ASC Problem In reply to
As a postscript to this -- after all the considered opinion above -- Ijust registered wwwthreads (perl) -- since it's where i need it to be now, and I just don't have time to learn the details of PHP as deeply as I have gotten into perl.

Anyway -- I still fee PHP (or it's successor) is going to be the way to go for "filling in the blanks" in "static"/template pages.

I've divided my time too thinly on too many projects, and I need to just stick with one language for now -- perl.

Given that... I'll have some additional solutions to problems that have been lingering here soon, and more.

I guess it's back to <IMG SRC> tags and <IFRAME> for advertising Smile



------------------
POSTCARDS.COM -- Everything Postcards on the Internet www.postcards.com
LinkSQL FAQ: www.postcards.com/FAQ/LinkSQL/