As everyone knows by now, the core of the taxonomy system has made its way into Habari. Tags have been converted to use it. There are experimental plugins, such as simplecategories in habari-extras, that use it. Unfortunately, Posts::get() hasn't been updated to be aware of the taxonomy system. It still is coded to accept only 'tags' and associated variations as a parameter.
In order to allow plugin authors and themers the ability to fully take advantage of taxonomy, Posts::get() should be revised to allow 'vocabulary' to be passed as a paramenter, along with 'term' and associated variations such as 'not:term', 'term_display', etc. such as we now have for tags. Currently I have this working on my local test install. The code I have in Posts::get() is at http://pastie.org/1207715. Changes also had to be made to the Theme, AtomHandler, Tag, and Tags classes, along with changes in Posts::search_to_get() for this to work. The changes were less extensive than I had feared, and left things pretty much as they are now from a site reader's point of view. These changes work well if only one vocabulary is allowed to be passed to Posts::get(). I think we can be guaranteed that that will be seen as a limitation and users will have use cases where more than one vocabulary should be allowed. The issue is how to deal with more than one vocabulary while stil keeping each 'term' and friends parameters associated with the proper vocabulary. There have been a couple of suggestions on how to do this. 1. Use an array. each vocabulary would have a 'name' and the needed 'term' parameters associated with it. For example: Posts::get( array( 'vocabulary' = array( array( 'name' => 'tags', 'term' => 'habari' ) , array( 'name' => 'categories', 'term' => 'php' ) ) ) ); Obviously, this can get complex, but it would accomplish the task of allowing more than one vocabulary while keeping all the 'term' params properly associated. We would only have to loop through the array of vocabularies. 2. Pass the vocabulary name as a parameter and let Posts::get() figure out that it's a vocabulary. For example Posts::get( array( 'category' => 'rental-properties' , 'term' => 'condos' ) ); We'd have to assume that unknown parameters are vocabularies and parse them out. Also, the example would need to be modified to ensure 'term' parameters get associated with the proper vocabulary. 3. Modify our current method of using colons to modify passed parameters to including passing the vocabulary name in it. For example: Posts::get( array( 'vocabulary' => array( 'tags:term' => 'php', tags:not:term' => 'sqlite', 'category:term' => 'programming') ) ); This would require more parsing in Posts::get(), but eliminates the nested arrays while at the same time associating each set of 'term' params with the proper vocabulary. The question is which is the best approach to take. Rick -- To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/habari-dev
