[campsite-support] John
  • Hi Guys

    i want to list articles from lets say 5 categories,

    the code i use is the following ,
    {{ local }}

    {{ set_section number="4" }}


    {{ list_articles
  • 3 Comments sorted by
  • Hi John,

    Good news, you can use some code like this:
    {{ list_article constraints="section is 4 section is 7 section is 21" }}

    instead of the multi-lists or conditional list workaround you were given.

    General format for this is:

    {{ list_article constraints="
    " }}

    You can see the list of integer_operators in the manual:
    http://code.campware.org/manuals/campsite/3.3/index.php?idc#operators

    This feature will be documented soon by the way.

    It was implemented by Mugur and it is part of 3.3.4 release, sorry I
    didn't know it till now Smile

    Cheers,


    2010/3/17 john papas
    >
    > Hi Guys
    >
    > i want to list articles from lets say 5 categories,
    >
    > the code i use is the following ,
    > {{ local }}
    >
    > {{ set_section number="4" }}
    >
    >
    > {{ list_articles
  • Hi John,

    First, you must use order="bypublishdate" instead of order="bydate",
    that is why you are getting the list ordered by index, basically
    (bydate is by article creation date).

    Second, from the code you pasted and just for the record, you should
    remove {{ set_section number="4" }} as you are using
    ignore_section="true" in the list definition.

    Hope this helps,


    2010/3/17 john papas
    >
    > Hi Guys
    >
    > i want to list articles from lets say 5 categories,
    >
    > the code i use is the following ,
    > {{ local }}
    >
    > {{ set_section number="4" }}
    >
    >
    > {{ list_articles
  • Hi John,

    Actually this won't work this way because the template engine applies AND
    operator to the list constraints.

    "section is 4 section is 7 section is 21"
    is equivalent to:
    "section is 4 and section is 7 and section is 21"

    So the proper construction in this example would be:
    "section greater 3 section not 5 section not 6 section not 8 ... section
    smaller 21"

    You don't need to use ignore_section in this case.

    But I'm wondering if in your case it would be better to use topics instead
    of sections...

    Also, please upgrade to 3.3.5 because 3.3.4 has a bug related to the
    articles list.

    Mugur

    2010/3/17 Holman Romero

    > Hi John,
    >
    > Good news, you can use some code like this:
    > {{ list_article constraints="section is 4 section is 7 section is 21" }}
    >
    > instead of the multi-lists or conditional list workaround you were given.
    >
    > General format for this is:
    >
    > {{ list_article constraints="
    > " }}
    >
    > You can see the list of integer_operators in the manual:
    > http://code.campware.org/manuals/campsite/3.3/index.php?idc#operators
    >
    > This feature will be documented soon by the way.
    >
    > It was implemented by Mugur and it is part of 3.3.4 release, sorry I
    > didn't know it till now Smile
    >
    > Cheers,
    >
    >
    > 2010/3/17 john papas
    > >
    > > Hi Guys
    > >
    > > i want to list articles from lets say 5 categories,
    > >
    > > the code i use is the following ,
    > > {{ local }}
    > >
    > > {{ set_section number="4" }}
    > >
    > >
    > > {{ list_articles name="articles" ignore_section="true" order="bydate
    > desc"}}
    > > {{ if $campsite->article->section->number == "2" ||
    > $campsite->article->section->number == '10' ||
    > $campsite->article->section->number == '14'}}
    > >
    > >

    {{ $campsite->current_list->index }} > template article.tpl" }}">{{ $campsite->article->name }}({{
    > $campsite->article->publish_date|camp_date_format:'%h:%i' }})


    > >
    > >
    > > {{ /if }}
    > > {{ /list_articles }}
    > >
    > >
    > > {{ /local }}
    > >
    > > it works with np
    > >
    > > my problem is that when i want to print the 10 first articles i can't
    > >
    > > {{ list_articles name="articles" ignore_section="true" order="bydate
    > desc"
    > > length="10"}}
    > >
    > > but the above code is not working like that, what it does is list all the
    > articles that their index is lower than 10, it doesnt count the number or
    > articles,
    > >
    > > i came to this result coz i add {{ $campsite->current_list->index }}
    > > to their index the numbers was 50, 67.... when i change the length to
    > 100
    > > it prints all the articles with index lower that 100 in this case 2,
    > >
    > > my question is:
    > > how can you print from many categories (i have the code for this)
    > > the most new articles, but print only the first 20,
    > > articles not the ones who have index lower than 20?
    > >
    > >
    > > thank you for the help
    > >
    > >
    > >
    > >
    > >
    > > __________________________________________________
    > > Χρησιμοποιείτε Yahoo!;
    > > Βαρεθήκατε τα ενοχλητικά μηνύματα (spam); Το Yahoo! Mail διαθέτει την
    > καλύτερη δυνατή προστασία κατά των ενοχλητικών μηνυμάτων
    > > http://mail.yahoo.gr
    >
    >
    > --
    > /holman
    >