jmdeldin / jmd_count
- Source
- Commits
- Network (0)
- Issues (0)
- Downloads (0)
- Wiki (1)
- Graphs
-
Branch:
master
| name | age | message | |
|---|---|---|---|
| |
Makefile | ||
| |
README.textile | ||
| |
count.php |
README.textile
jmd_count: Count stuff.
This plugin counts rows in Textpattern tables and plugin-created tables.
<txp:jmd_count table="table_name" where="where_clause"/>
| Attribute | Available values | Default value |
|---|---|---|
table |
Existing MySQL table | — |
where |
Valid WHERE clause |
— |
Example: Return the number of pending articles:
<txp:jmd_count table="textpattern" where="Status=3"/>
<txp:jmd_if_count eval="comparison" table="table_name" where="where_clause">
Same attributes as jmd_count with the addition of eval.
| Attribute | Available values | Default value | Description |
|---|---|---|---|
eval |
Comparison operators | — | Compare the counted rows to eval (e.g., eval=">=1") |
<txp:jmd_if_count eval=">30" table="txp_form">
Whoah! <txp:jmd_count_value/> forms is ridonkulous.
</txp:jmd_if_count>
<txp:jmd_count_value/>
No attributes. Returns the value from jmd_if_count.
Example: Site statistics
<table>
<tr>
<th>Item</th>
<th>Count</th>
</tr>
<tr>
<td>Live articles</td>
<td>
<txp:jmd_count table="textpattern" where="Status = 4"/>
</td>
</tr>
<tr>
<td>Comments</td>
<td>
<txp:jmd_count table="txp_discuss" where="visible = 1"/>
</td>
</tr>
<tr>
<td>Images</td>
<td>
<txp:jmd_count table="txp_image"/>
</td>
</tr>
<tr>
<td>Files</td>
<td>
<txp:jmd_count table="txp_file"/>
</td>
</tr>
<tr>
<td>Site hits</td>
<td>
<txp:jmd_count table="txp_log"/>
</td>
</tr>
</table>
Tip: Combine jmd_count with jmd_dashboard :).

