kumarachi wrote:
> Hello,
>
> Could someone help me please.
> I am having some trouble creating links from an array in my JSON data.
>
> I have this snippet from my data.js:
> "scriptURI" :        [
>                               "walkthrough.doc",
>                               "overview.doc",
>                               "datasheet.docx"
>                       ],
>
> And in my exhibit file, I want to be able to show these items as href
> links in an Unordered List inside a Lens like this:
> <ul>
> <li><a href="../scripts/walkthrough.doc">walkthrough</a></li>
> <li><a href="../scripts/walkthrough.doc">overview</a></li>
> <li><a href="../scripts/walkthrough.doc">datasheet</a></li>
> </ul>
>
> I am sure this has been done many times elsewhere...
>
> I am looking through the various examples for examples of iteration on
> such fairly simple data - and attempted to use the foreach function,
> but somehow cant get this working.  I dont quite understand what the
> correct syntax is...and I am not even sure if using foreach is the
> right approach.
>
> I seem to get them all concatenated together, or in other variations,
> I receive an error about G[1] undefined...What should the second
> parameter here be?
>
> <ul>
> <li><span ex:content="foreach(.scriptURI,???)"></span></li>
> </ul>
>
>
> Can anyone help me?
>   

Kumar,

Try

<ul ex:content=".scriptURI">
    <li><a ex:href-subcontent="../scripts/{{value}}" 
ex:content="value"></a></li>
</ul>

Elements inside an element with ex:content are used as a template for 
rendering each value in the set that the ex:content expression evaluates to.

David


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"SIMILE Widgets" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/simile-widgets?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to