Gossamer Forum
Home : Products : Gossamer Links : Discussions :

How to create a main-category

Quote Reply
How to create a main-category
Hello everyone!

I'm wondering how to tell LinksSQL that a category is a main-category and another category isn't. For example I have an url lets say www.xyz.com which is attached to four categories. LinksSQL now shows me (after searching of course) a category and the link, but not necessarly the category i want it to show (which should be the main category). In my opinion it shows me the deepest category.
E.g. cat1 -> subcat1 -> subsubcat2
cat2 -> subcat2 -> subsubcat2 -> subsubsubcat2
cat3 -> subcat3

With this cat-structure above it will show me cat2.
How do I change this?

I hope anyone can help or point me to somewhere useful.


Quote Reply
Re: How to create a main-category In reply to

I brought this issue up during the betas.

The CatLinks table needs another field -- "order" or "primary" -- to do this, but that adds somewhat of a major level of management, as you'd then need an editor function to manage it, and make sure that only one field was "primary" or that "Order" contained a proper 1...N sequence of numbers for that link.

While it might be complex, the "overhead" is not a factor, since this only comes into play when a link is added, modified, or edited, not during display or searches.

Right now, the link is returned with the first category found in the database.

In the Image Gallery plugin, in the Attachments table, I've tried to take this into account by using the "Slot" field, which is really a display-order field. Perhaps, once I connect it properly, it could be generalized out as a plugin, since as I pointed out above, the "order" only comes into play during specific functions, any "null" order field would be ignored, but the indexes on the CatLinks table could be rewritten as :


In which case, a select on LinkID, should return the Links in "order" order, and thus allow for structuring the "primary" category of a link.

The "order" field (or Primary field) would work in a similar manner as the Slot field in the Image Gallery. The plugin, or added code, would have to enforce that each Link had at least one, and only one, Primary Category defined. This could be added to repair tables, I guess, to catch errors, but it would have to "hook" on any admin-edit action of the link as well.

With the use of a Primary field, the logic would be binary "0/1", while with the use of an order field, the logic would be "1....N" ordering.

For the purposes of picking a category, the "primary" logic would be the most correct.

PUGDOGŪ Enterprises, Inc.
Quote Reply
Re: How to create a main-category In reply to
Thanks for your advice!
I'm right now on my way to update LinksSql that is able to handle main-alternate categories well.