Multiple Viewers of same content with variation

3 posts by 3 authors in: Forums > CMS Builder
Last Post: August 17, 2008   (RSS)

By benedict - August 16, 2008

Hi guys,

Love the CMS - really seeing it as becoming a corner stone of what we do. But I have a problem.

It relates to an articles section I am presenting as a sidebar on my page. The first list viewer presents the 3 most recent articles posted to the articles table, which works fine.

Beneath this, I am attempting to put in a second list viewer that also presents 3 articles, but this time it is only presenting articles that have been ticked as "Most Read" in the articles table. I have pasted the code at the top of the page and the logic is all correct, but when I paste in the code in the second sidebar section ("Most Read Articles") it presents exactly the same info.

Looking at the code, it is identical to the code that appears in the first sidebar, so I can see why it is presenting the same info. How do I get it to present the "Most Read" data?

To see the issue, please visit www.bir.net.au/articleDetailBIR.php

Thanks.

Re: [sagentic] Multiple Viewers of same content with variation

By Jake - August 17, 2008

Hi benedict,

Thanks for your post!

Sagentic's method will work, and would help to keep your files organized a bit. There is another method available though, which is to change the names of the variables used in your "STEP 1" code. Take this code for example:

<?php

require_once "/path/to/lib/viewer_functions.php";

list($newsRecords, $newsMetaData) = getRecords(array(
'tableName' => 'news',
'limit' => '1',
));

?>


If you wanted to display the same content differently, you could rename the variables and append it like this:

<?php

require_once "/path/to/lib/viewer_functions.php";

list($newsRecords, $newsMetaData) = getRecords(array(
'tableName' => 'news',
'limit' => '1',
));

list($newsHeadlineRecords, $newsHeadlineMetaData) = getRecords(array(
'tableName' => 'news',
'limit' => '5',
));

?>


You would then adjust the second set of list code used later in the page to match the variable names you used there.

Feel free to contact us if you have any further questions about this. [:)]
-----------------------------------------------------------
Cheers,
Jake Marvin - Product Specialist
support@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.