+1
Отвечен

I'm having trouble with datasources. Any idea what I'm doing wrong?

thillsman 12 лет назад обновлен icahill (Administrator) 12 лет назад 3
I'm working with using a datasource of an image RSS feed, but I can never get the images to appear. I've tried to distill the datasource gallery sample code to its bare essentials. Here's my code:


<wire>
<datasources>
<datasource name="gallery" source="" query="//item" providertype="xml" parsenamespaces="yes"/>
</datasources>
<styles>
</styles>
<classes>
<class name="image">
<image name="[param:index]" height="100%" align="center" valign="center" contain="yes" source="[param:sourceMain]" _page="[param:index]" />
</class>
</classes>
<main>
<panel name="slides" alias="SLIDES" width="100%" height="100%">
<list name="scroller" width="100%" height="100%" datasource="gallery" orientation="horizontal" paginate="yes" >
<object class="image" index="[param:dataSourceIndex]" sourceMain="[param:url]"/>
</list>
</panel>
</main>
<actions>
<action name="load" oninit="yes" >
<assign property="datasource:gallery.source" value="http://widget.stagram.com/rss/n/thillsman" />
<assign property="var:curPage" value="1"/>
</action>
</actions>
</wire>


The URLs for the images are located at rss/channel/item/url in this XML file: http://widget.stagram.com/rss/n/thill... but my code doesn't seem to find them. Any ideas?
It looks like your [param:url] is one level deeper than you think, it should be [param:image/url]. That should do the trick.

keep up the good work!
Hmm... that didn't work either. I tried [param:image/url] and [param:img/url]. The < img> tag that comes before the tag in the feed is never closed. So I tried downloading the XML file locally, deleting the < img> tags, uploading it to my app files, and setting it as my datasource value as a relative link. But that didn't seem to work either.

Do I have any options to force it to pull from the right place with parsenamespaces="no"?
Oh there is one more thing that you need to change. I am sorry. instead of "source" on your image tag, you need to change it to "url" since your image source is coming from a url.

Сервис поддержки клиентов работает на платформе UserEcho