Gossamer Forum
Home : Products : DBMan : Customization :

Sorting by Categories

Quote Reply
Sorting by Categories
Hi - hopefully this isn't a repeat post. I have searched everywhere that I know and am stumped.

I have a database with categories, I would like to do a couple things:

1. When the "form" comes up, I would like the user to be able to see the available categories from the drop-down box. Rather than hard-coding the categories.

2. I would like to incorporate a few different searches. One of them is to show ALL records by category. So at the top of the html file I would list each category, which they could click to bring them to that portion of the html file. Then, below it would display each record under the appropriate category

Category1 | Category2 | Category3 | Category4 | (clickable)

Category1

Item 123 (also clickable, but brings the user to a page with just this record on it)

Item 345

Item 567

Category2

Item 111

Item 222

Item 333



Well anyways, hopefully that all makes sense!! Hopefully someone can help, I have been reading the posts and the responses are incredible to other posts. Lastly, has anyone used the category mods that are available here? Any probs with the latest version of dbman?



Thanks again!!
Quote Reply
Re: [now@cox.net] Sorting by Categories In reply to
1. You can do this by setting up your field as a select field and defining your categories within your .cfg file such as:

'Category' => [ 2,'alpha',0,22,1,'',''],

# Select fields. Field name => 'comma seperated list of drop down options'.
%db_select_fields = (
'Category' => 'Category 1,Category 2,Category 3'
);

2. You can setup a custom search form an which could include the option to display all categories with current listings using:

<TR><TD><$font>Category:</FONT></TD><TD>|; print &build_select_field_from_db("Category",$rec{'Category'}); print qq|</TD></TR>

For the rest of your display where it would just show the titles which would then take them to the full records you should check out the userfriendly short/long mod. This mod will provide you with what you need.

Many people have used the category mods, and no there are no problems with the latest version of DBMan.

Please visit the FAQ noted below as there are numerous tips and tricks for setting up and customizing your script.

Unoffical DBMan FAQ
http://redundantcartridge.com/dbman/
Quote Reply
Re: [LoisC] Sorting by Categories In reply to
Thanks for the reply. I may not have been clear when I explained what I was looking for. I know about setting up the fields, and have that part working just find but what I would really like to do is either have a separate database with just the categories or if dbman could pull the categories from the database to create the drop-down list. I'm working with someone that knows nothing about html and I would hate to have to explain how to go in and add a category to the "raw" data.

Thank you for your response though. I will check out the other info you indicated.
Quote Reply
Re: [now@cox.net] Sorting by Categories In reply to
Yes, you can have another database which lists the categories and you can call that field into another database. There is information in the FAQ under the section for Multiple databases.

Is the drop down for use within the database or on a static page?

Unoffical DBMan FAQ
http://redundantcartridge.com/dbman/
Quote Reply
Re: [LoisC] Sorting by Categories In reply to
The drop down would be for the main database. Rather than hard-coding the "category" field, I just want it to pull in the data from the main or another database and create the drop down (by adding the <option></option> tags, etc.)
Quote Reply
Re: [now@cox.net] Sorting by Categories In reply to
A few references you might want to check out in the FAQ under the section "Fields" are:

Select a category - add record and carry selection to add_form

Building Fields from other databases (sub build_external_select_field) + (creating dropdown list from database)

Self maintaining drop down

Dynamic drop down list (from .txt file)
- I have used this mod so one file can easily be modified to hold the contents of my select field

By searching the FAQ and viewing other related threads you will see what options are available and then find a solution that would best met your needs.

Unoffical DBMan FAQ
http://redundantcartridge.com/dbman/