Jump to content

Download: Database Category Block with Category Record Count


Sailfindragon
 Share

Recommended Posts

File Name: Database Category Block with Category Record Count
File Submitter: Sailfindragon
File Submitted: 22 Nov 2010
File Updated: 22 Nov 2010
File Category: IP.Content Blocks

If you wish to have the total records count show next to each category within the category block.

Copy this code into your block template.

<div class='general_box'>

	<h3>{$title}</h3>

	<ul class='hfeed'>

		<if test="is_array( $records ) && count( $records )">

		{parse striping="feed_striping" classes="row1,row2 altrow"}

		<foreach loop="$records as $r">

			<li class='hentry {parse striping="feed_striping"}' style='padding: 4px 4px 4px {parse expression="$r['level']*20"}px;'>

				&bull; <a href='{$this->registry->ccsFunctions->returnDatabaseUrl( $r['category']['category_database_id'], $r['category']['category_id'] )}'>{$r['category']['category_name']}&nbsp;({$r['category']['category_records']})</a>

			</li>

		</foreach>

		</if>

	</ul>

</div>

<br />


  

If you are using the media category block that came with the IP Content Demo Replace this


<foreach loop="$this->_categories[ $r['category_id'] ] as $sub">

								<li>

									<a href='{$this->registry->ccsFunctions->returnDatabaseUrl( $sub['category_database_id'], $sub['category_id'] )}'>{$sub['category_name']}</a>

								</li>

							</foreach>

With


<foreach loop="$this->_categories[ $r['category_id'] ] as $sub">

								<li>

									<a href='{$this->registry->ccsFunctions->returnDatabaseUrl( $sub['category_database_id'], $sub['category_id'] )}'>{$sub['category_name']}&nbsp;({$sub['category_records']})</a>

								</li>

							</foreach>



Click here to download this file

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...