Limit number of items to display in a format
I have an index block that grabs a list of items and a format that displays them on the homepage. I was originally limiting the number to display in the index block. The problem is in my format I had to check a data definition field to see if that item should be displayed or not. This works, however I need to consistently have 4 items display so this would result in too few appearing.
What I'm wanting to do is set the index block's max rendered assets to a higher number and then use an XSLT counter to ensure only 4 appear. Can you tell me how to accomplish this?
Discussions are closed to public comments.
If you need help with Cascade CMS please
start a new discussion.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
1 Posted by Ryan Griffith on 30 Jun, 2015 02:49 PM
Hi,
To accomplish this, I would have an
<xsl:apply-templates>
call that filters the items based on the field (and optionally sort the items). This would apply your "item" template to output each of the items. Within the "item" template, you would check to see if the item'sposition()
is less than 5 (or less than equal to 4).Consider the following example for starters:
Please let me know if you have any questions.
Thanks!
2 Posted by rgraves2 on 30 Jun, 2015 03:47 PM
Thanks. This seems to have worked. I'll let you know if I have any other questions.
3 Posted by Ryan Griffith on 30 Jun, 2015 04:07 PM
Not a problem at all, I am glad to hear that the proposed solution did the trick.
I'm going to go ahead and close this discussion for now, but please feel free to comment or reply to re-open if you have any additional questions.
Have a great day!
Ryan Griffith closed this discussion on 30 Jun, 2015 04:07 PM.