Re: [Toledoh] Display number of items on list page
Hi Tim,
Here’s a recipe from the CMSB Cookbook
http://www.thecmsbcookbook.com that might help.
WANT TO SHOW A RECORD COUNT ON YOUR WEB PAGEYou can use this to see the total number of records displayed:
<?php echo $your_table_nameMetaData['totalRecords']; ?>
There are a few other variables that can be used besides “totalRecords”. You can list them all with this code:
<xmp><?php print_r($your_table_nameMetaData); ?></xmp>
Here's another approach to counting the number of records in a particular category. (change the "if" criteria to suit your needs, and if you're using more than one counter on your page, change $count to some unique name, like $count2, or $count3),
First set a counter to zero.
Then in your "foreach" loop, if a record meets a particular set of criteria, increment the counter by 1 for each record that meets that criteria.
Finally, display the record count.
<?php $count = 0; ?><?php foreach ($my tableRecords as $record): ?<?php if ($record[your field'] != 1): ?><?php $count++; ?>
And where you want to display the count:
There are <?php echo $count ?> records
Hope that gives you some ideas.
Jerry Kornbluth
The first CMS Builder reference book is now available on-line!
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php