Display No.Records in List Viewer

4 posts by 2 authors in: Forums > CMS Builder
Last Post: December 30, 2008   (RSS)

By avrom - December 24, 2008

Hi Dave,

I have a list viewer that will display a number of ads. But instead of just listing all of them or a predetermined number, it will be specified by the client:

<?php echo $site_templateRecord['number_of_ads'] ?>

SO how to combine into the list viewer for the Ads section ?

<?php foreach ($ads_125x125Records as $record): ?>


Thanks Dave :))
Avrom

Re: [virgodesign] Display No.Records in List Viewer

By Dave - December 27, 2008

Hi Avrom,

Try passing the value directly to the getRecords() code like this:

"limit" => (int) $site_templateRecord['number_of_ads'],

The (int) isn't really required, but it will force the value to be a number in case the client enters something else and prevent errors.

Just make sure you load $site_templateRecord first. Let me know if that works and any other issues you have remaining and I'll try and help! :)
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Display No.Records in List Viewer

By avrom - December 30, 2008

Dave,

Figured it out :)) Just ran a second while loop for the ads not in the record, and maintained a counter in both loops.

Thanx :))
Avrom