Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

« Newer Snippets
Older Snippets »
Showing 21-23 of 23 total

Category Count

{exp:query sql="SELECT count(exp_category_posts.entry_id) AS count,exp_category_posts.cat_id, exp_categories.cat_name
FROM exp_categories, exp_category_posts WHERE exp_category_posts.cat_id = exp_categories.cat_id GROUP BY exp_categories.cat_name"}

<a href="{path=weblog/view}C{cat_id}/">{cat_name}
a> ({count})

{/exp:query}


Displays a list of categories with an entry count for each category. Alternatively, you can also use this query together with the {exp:weblog:categories} tag, making the query a lot smaller:

{exp:weblog:categories weblog="weblog1"}
<a href="{path=weblog/index}">{category_name}a>
{exp:query sql="SELECT count(exp_category_posts.entry_id) AS count
 FROM exp_category_posts  WHERE exp_category_posts.cat_id =  {category_id} "}
({count} entries)
{/exp:query}
{/exp:weblog:categories}

Related Entries

<ul>
{exp:weblog:related_entries weblog="caps" orderby="title" sort="asc"}
<li><a href="{title_permalink="caps/view"}">{title}a></li>
{/exp:weblog:related_entries}
</ul>


Lists all entries in the same category as the one you're currently viewing.

Category Header

{exp:weblog:category_heading  weblog="weblog1"}{category_name}{/exp:weblog:category_heading}

Show the currently viewed category as a heading outside of the {weblog.entries} tag.
« Newer Snippets
Older Snippets »
Showing 21-23 of 23 total