This documents this thread from the Coranto Support Forum.

The Question

I'm trying to do the following. I have a main profile called news that pulls posts from several categories. Is there a way to only say select three of each category to display?

Answer One by Dale Ray

    $show = 1;
    if ( isNewCategory() ) {
    $count = 1;
        } else {
    if ($count > 3) {
    $show = 0;
    if ($show) {
    <If: Field: count == 1><Field: Category></If>
    <Field: Date> - <Field: Hour>:<Field: Minute>:<Field: Second> <Field: AMPM>
    <Field: Subject>
    <Field: Text>

Sort by category using the SortOrders addon.


<If: Field: count == 1><Field: Category></If>

will cause the category name to only print when a new category starts.


if ($show) {

before the closing </PerlCode> tag eliminates a bunch of whitespace that happens if you use:

<If: Field: show>

after the closing </PerlCode> tag.

This should give you the three newest items in each category if all of your filter settings for the profile are empty.

Answer two by Parahead

Or if the sorting by Category is not wanted, one could use:


    if($countitems{"$ProfileName-$Category"} > 3) {

Taking it Further

Change the constant from 3 to whatever value you want.

Page last modified on February 02, 2009, at 03:45 AM