Limiting records, orders in different sections on one viewer page

3 posts by 2 authors in: Forums > CMS Builder
Last Post: January 11, 2016   (RSS)

By hiroko - January 9, 2016

Hi,

This seems to work fine for now, but can anyone tell me if this approach will cause any trouble? (for example, it will slow down the loading if I have a lot of records)

I wanted to list the blog records in different ways on one page and was having problem with the search result page and category list page.

The footer and sidebar where I wanted to get all the blog records where limited by the 'where' and search result.


  // load records from 'blog' perPage content section
  list($blogPerPageRecords, $blogPerPageMetaData) = getRecords(array(
    'tableName'   => 'blog',
    'loadUploads' => true,
    'allowSearch' => false,
    'perPage'     => '6',
  ));
  // load records from 'blog' sidebar recommend section
  list($blogRecommendRecords, $blogRecommendMetaData) = getRecords(array(
    'tableName'   => 'blog',
    'loadUploads' => true,
    'allowSearch' => false,
    'limit'     => '3',
    'orderBy'     => 'RAND()',
  ));
  // load records from 'blog' footer section
  list($blogRecentRecords, $blogRecentMetaData) = getRecords(array(
    'tableName'   => 'blog',
    'loadUploads' => false,
    'allowSearch' => false,
    'limit'     => '5',
  ));

Thank you,

Hiroko

By hiroko - January 11, 2016

Hi Ross,

Thank you for the reply!

Hiroko