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 ross - January 11, 2016

Hi Hiroko

Thanks for posting.

I don't see a problem with your code.  You've got three basic database calls and that should be fine.  

Let me know any questions.

Thanks!

-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/