Hey Everyone,
Was going to see if anyone could help me out with a problem I'm trying to solve. Basically in a nutshell, I have 2 lists that I am iterating through, and I am trying to match index values of the items in each list up. So for example:
property1 = Bill, Steve
property2 = Gates, Jobs
And my code looks as follows:
This code prints out:
<meta name="Bill" content="Gates"> <meta name="Bill" content="Jobs"> <meta name=" Steve" content="Gates"> <meta name=" Steve" content="Jobs">
But I want them to only print out the same index values, so the output I WANT is:
<meta name="Bill" content="Gates">
<meta name=" Steve" content="Jobs">
I've been wracking my brain trying to figure out how I can do this, if anyone can offer any advice / help, I would GREATLY appreciate it!
Thanks in advance!!
Hello,
I did a little checking on freemarker, and from what I found, you want to have:
<#if (property1')?exists && (property2')?exists)>
<#list JiveGlobals.getJiveProperty('property1')?split(",") as metaNAME>
<meta name="${metaNAME}" content="${property2[metaNAME_index]}">
</#list>
</#if>The reason you were getting that output is that you were nesting a loop inside another, so for every iteration of the outer loop you ran through the entire inner loop. This way, you'll only run through the outer loop, and since you index the last-name-list with your loop variable, your last names will stay in sequence with your first names. Hope that helps.
Thanks,
Kevin
Thanks Kevin for the quick response!
I know why that's my problem, but I don't know much about freemarker to be able to control my output. I'm pretty sure there isn't a clean way to do any indexing or a .length function like Java. So that's why I posted up if anyone could help me out.
If anyone has any ideas, I would be forever grateful! =)
Thanks!
Kevin,
Thank you so much for your updated response sir! That exactly did the trick!!!!!!!!!!!!!
I really appreciate your help in helping me solve my problem!
Have a great weekend, and thanks again!
Airman
Jive combines the most powerful features of collaboration software, community software,
social networking software & social media monitoring into the leading SBS solution.
© Copyright 2000–2010 Jive Software. All rights reserved.
915 SW Stark St., Suite 400, Portland, OR 97205
Sales: 877-495-3700 | General: 503-295-3700
Privacy Policy | Sitemap | Jobs | Contact Us