Availability
blojsom 3.2
Description
Counts the number of entries for the categories within a blog.
Installation and Setup
In your /WEB-INF/classes/blojsom-plugins.xml file, add the following:
<bean id="entries-per-category" class="org.blojsom.plugin.common.CountEntriesForCategoryPlugin" init-method="init" destroy-method="destroy">
<property name="fetcher">
<ref bean="fetcher"/>
</property>
</bean>
You may then add "entries-per-category" to one of the flavor-based plugin chains.
Usage and URL Parameters
Context Attributes and Types
The following table describes the context attributes that are available and their associated type.
| Context key |
Input or Output |
Type |
Description |
| PLUGIN_ENTRIES_PER_CATEGORY |
Output |
java.util.Map |
Keys are the category ID (Integer) and the value for a given key is an Integer of the # of entries for that category ID. |
Usage
In looping through your categories, you can include some template code such as the following Velocity code to display the number of entries in a category:
($!PLUGIN_ENTRIES_PER_CATEGORY.get($category.getId()))