Maintain Min amount of records in table and total records

4 posts by 3 authors in: Forums > CMS Builder
Last Post: February 7, 2011   (RSS)

By Twocans - February 5, 2011

hello,

I see you guys have a Max Records Field

Admin > Section Editors > Advanced> Max Records

It would be really great were you to add a Minimum Records also.

Take for example

http://216.119.114.156/elevator-panel.php

I have a few of these panel types which I got from pvii, they work very well with your cms. In the example above I would want to make sure my user always had a minimum of 1 record.

So it would be really great were the cms had a function of setting the "Minimum Records" and also been able to call a variable for the "Total Records in table" .

Cheers

kenny

Re: [twocans] Maintain Min amount of records in table and total records

By gkornbluth - February 5, 2011 - edited: February 5, 2011

Hi Kenny,

This short recipe from my CMSB Cookbook http://www.thecmsbcookbook.com might help to get you started.

WANT TO SHOW A RECORD COUNT ON YOUR WEB PAGE

You can use this to see the total number of records displayed:

<?php echo $your_table_nameMetaData['totalRecords']; ?>

There's a few other variables that can be used besides “totalRecords” as well, you can list them all with this code:

<xmp><?php print_r($your_table_nameMetaData); ?></xmp>
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

Re: [twocans] Maintain Min amount of records in table and total records

By Jason - February 7, 2011

Hi Kenny,

How would you want this feature to work? What would happen if a user had fewer than the Minimum number of records?

If it's a matter of figuring out how many records you're working with at run time, you could use the php count() function.

For example:

<?php
$recordsReturned = count ($listingsRecords);
?>


You can then test this value to make sure it falls within the range you want.

Would this accomplish what you need?

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/