Customizing query output table

edited August 2011 in Modules
I have a simple "Categories" table and was wondering if there was any way to append the number of entries in that category in some way. For example having one category with 4 posts I would like "Category One (4)" appear. Is there any way to do this inside a model?

Comments

  • edited 11:26AM
    This can be done in your querying. The blog_posts_to_categories_model in the fuel/modules/blog/models/ has an example of adding the count and it is placed in the _common_query() method which gets run with any find_* method on the model.
  • edited 11:26AM
    Ok...so things seem to be fairly smoothly but I just found a glitch in one of my forms. I have two tables as part of my 'bio' module called 'bio_categories' and 'bio_people'. My problem is that although everything shows up as it should the label on Category reads 'Bio category' for some reason. I never set that name in the bio_people model and thought the problem might be in the bio_categories model but I've yet to discover where the problem might be emanating from.

    Any help would be much appreciated.
  • edited 11:26AM
    You can overwrite any label by passing in the 'label' parameter on your form field.
Sign In or Register to comment.