Categories > TinyButStrong general >

Choose Categories

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Mra
Date: 2008-02-06
Time: 05:40

Choose Categories

I have made a script that where people can choose categories of TV shows.

http://www.american-dad.de/pgms/admin/index.php?section=categories

So far, people can not actually choose since no PHP code is executed when the data is sent to the server.  However, for the use of TBS it is irrelevant.

The first table was simply made by PHP and echo.  I just made a foreach loop with all database entries and displayed them.  I could figure out most of it - except the superior_category.

In superior_category should not the current category of the loop be listed, since it does not make any sense to make one category to its own subcategory.  Therefore, I need a TBS code that can disable the array element, if it is the category by itself.

Another problem is the selected attribute in HTML.  The superior_category is saved in the database with the id of it.  For instance, if the superior_category is Dramedey, the id 1 is saved in the array under superior_category.  Somehow, I have to make a comparison between the option-loop and that superior_category value in order that the accurate superior_category is already selected.

How can I do that?  Sorry, if my descriptions are a little bit confusing.
By: Skrol29
Date: 2008-02-07
Time: 11:46

Re: Choose Categories

Hi Mra,

First feature : you want to display listboxes for each category with all items but without the item of the current category.
You can to that using the subblocks. First you merge the table of category, and then you merge all listbox items using the technic of subblocks and a dynamic query. There is an example of subblock in the Example section of this web site.

Second feature : you want the parent category to be selected in each listboxes.
This can be done using the plug-in HTML. It has such a feature. It is a good solution if there is not a lot of item to select. If you have lot of items to select in the same page, it is better to use Javascript.