Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
checking iw_iterate var value
vish
hi,
I need to check the number of links entered in the DCT, if the number of links exceeds say 10 i need to start displaying the links in a new collumn. I am using iw_iterate to get the links from the dct to the presentation template, but how do i check whether it is the 10th link or not and how do i start displaying in a new column? Is there any way to get the var value of iw_iterate? Any suggestions is greatly appreciated.
Find more posts tagged with
Comments
gzevin
iw_iterate is in fact, a perl 'for' loop.
e.g., you can write something like:
foreach my $column (iwpt_dcr_list('dcr.columnLinks')) {
}
as an analogue of iw_iterate
as a matter of fact, I almost never use iw_iterate
Greg Zevin, Ph.D. Comp. Sc.
Independent Interwoven Consultant/Architect
Sydney, AU
Adam Stoller
If you look at the documentation for iw_iterate - you'll see that there is a default counter (iw_iteration) which can be overriden by specifying an iteration attribute in the iw_iterate element:
This ... can be used ... by tags like <iw_if> to determine how many elements within a list have been iterated through so far ...
It then goes on to show an example with nested iterations where it fictiously does something special on the 0th, 10th, 20th, etc. iteration.
Alternatively you could write it all in Perl within <iw_perl> tags ...
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
cliffhanger
Besides what Greg and Fish has already suggested, you could also use iwpt_dcr_list('dcr.ITEM_NAME') if you would like to get the number of replicants upfront.