Showing multiple sections on one main viewer page

3 posts by 3 authors in: Forums > CMS Builder
Last Post: June 12, 2013   (RSS)

By wevolutions - June 11, 2013

I have a regular section and a premium section on my website. I want to show regular ads plus premium ads on one viewer page but the premium ads must be on top of the regular ads. Any assistance will be appreciated. Thank you.

By gregThomas - June 12, 2013

Hi,

You should just be able to include two getRecord functions at the top of your page and display the premium adds first, for example your getRecord functions might look like this:

  // load records from 'add'
  list($normalAdds, $addMetaData) = getRecords(array(
    'tableName'   => 'normal_add_section',
    'loadUploads' => true,
    'allowSearch' => false,
  ));

  // load records from 'add'
  list($premiumAdds, $addMetaData) = getRecords(array(
    'tableName'   => 'premium_add_section',
    'loadUploads' => true,
    'allowSearch' => false,
  ));

Then you'd be able to display the content from each section like this:

<?php foreach($premiumAdds as $add):?>
  <!-- premium content fields here -->
  <p><?php echo $add['title']; ?></p>
<?php endforeach; ?>

<?php foreach($normalAdds as $add):?>
  <!-- normal content fields here -->
  <p><?php echo $add['title']; ?></p>
<?php endforeach; ?>

This is just example code, so you'll have to make a few changes to get it working. 

So the two getRecords functions will retrieve the data from the premium and regular ads sections, you'll need to change the section names to match what you've used in your CMS. 

Then on the part of the page where you want to display your ads you need to cycle through each of the ad arrays using a foreach loop to display their content.

Let me know if you have any questions.

Thanks!

Greg 

Greg Thomas







PHP Programmer - interactivetools.com