+1
Abgelehnt
Help with object/wire variables within a list
I've got a list that is pulling from an rss feed from our website. Each item in the list pulls and displays the article title and author. Our website actually has a different blog title that corresponds to each author. I've been unable to include these blog titles in the feed despite my best efforts. My hope is that I can use object variables to create a variable _author for each item in the feed and then assign a parameter "blog-title" a string value using if statements and an assign action.
However, I haven't been successful yet. I think the problem might be that I'm not really going for a one-to-one interaction so to speak. I've got one assign action and many objects within the list that are interacting with it. Does this sound right? Is this surmountable?
Alternatively, maybe I'm just setting it up wrong? I've tried setting up a wire variable which just seems wrong. And I've tried to just use an object variable exclusively. Please see the wire code below.
Here are what I think are the relevant parts of the wire.
EDIT: I'm having trouble pasting the code in. Any hints on that as well?
<!-- this is the action with the wire variable -->
<!-- this is the version with just the object variable -->
However, I haven't been successful yet. I think the problem might be that I'm not really going for a one-to-one interaction so to speak. I've got one assign action and many objects within the list that are interacting with it. Does this sound right? Is this surmountable?
Alternatively, maybe I'm just setting it up wrong? I've tried setting up a wire variable which just seems wrong. And I've tried to just use an object variable exclusively. Please see the wire code below.
Here are what I think are the relevant parts of the wire.
EDIT: I'm having trouble pasting the code in. Any hints on that as well?
<!-- this is the action with the wire variable -->
<!-- this is the version with just the object variable -->
Customer support service by UserEcho
-object class="link-box" alias="LINKBOX" dataSourceIndex="[param:dataSourceIndex]" title="[param:title]" author="[param:*[local-name()='creator']]" blog-title="" lhs="[param:dataSourceIndex]" operator="lte" rhs="10"/>
-action name="two" datasource="field" datasourceevent="querycomplete">
-if lhs="_author" operator="e" value="William Deresiewicz">
-assign property="object:LINKBOX.blog-title" value="ALL POINTS"/>
-/if>
-if lhs="_author" operator="e" value="Jessica Love">
-assign property="object:LINKBOX.blog-title" value="PYSCHO BABBLE"/>
-/if>
-/action>
The wire variable basically created a new variable called var:title and set it equal to _author then the if statement looked at [var:title] to see if it matched the string.
because your action is triggered on querycomplete and not through an onclick in your class, the _author isn't being found.
Could you instead use the datasource to drive your IF statements?
-if lhs="[datasource:field.*[local-name()='creator']]" operator="e" value="William Deresiewicz">
-assign property="object:LINKBOX.blog-title" value="ALL POINTS"/>
-/if>
Also you probably need to reassign the object for blog-title in the class as I don't think it is possible to give an ALIAS to an object tag that is populating dynamically.
The first approach involved leaving the text value for BLOGTITLE at "" and trying to assign that value directly from the if statements. It didn't work and seems intuitively wrong to me because it's really within the list that wire is pulling is creating the unique values for each blog post.
The second approach means setting BLOGTITLE text="[param:blog-title]" and then trying to assign the value to the blog-title within the list. This approach is listed below. My hope is that I'm close with this but that I'm just getting the pathing wrong when I'm trying to assign the values within the if statements. What I'm showing below is obviously not right. I tried other things, including giving an alias to the list and then trying to path down to blog-title.
<datasource name="field" source="http://theamericanscholar.org/feed/dailyscholar" query="//item" providertype="xml" parsenamespaces="yes" />
<if lhs="[datasource:field.*[local-name()='creator']]" operator="e" value="Jessica Love">
<assign property="object:LINKBOX.blogtitle" value="PSYCHO BABBLE"/>
</if>
Then I've got the text setup inside of the class
<class name="link-box">
<panel name="[param:name]" width="250" height="123" onclick="load-article" _dataSourceIndex="[param:dataSourceIndex]" _author="[param:author]">
<text name="blog-title" alias="BLOGTITLE" style="blog-title" width="100%" height="30" align="left" leftinset="10" ypos="5" text="[param:blog-title]"></text>
</panel>
</class>
Then I've got the actual list with the object
<list name="list" datasource="field" width="100%" height="123" lheight="0%" align="center" valign="top" orientation="horizontal" paginate="no">
<object class="link-box" dataSourceIndex="[param:dataSourceIndex]" title="[param:title]" author="[param:*[local-name()='creator']]" blog-title="" lhs="[param:dataSourceIndex]" operator="lte" rhs="10"/></list>
First of all your if statements can't live in the datasource tag, they have to be listed as part of an action tag.
you are calling a parameter for "name" but are not defining it on the object tag.
You are on the right track with the if statements, just make sure that you are calling the correct alias within the object property. you are probably looking at
<assign property="BLOGTITLE.text" value="PSYCHO BABBLE"/>
If you want I can take a look at your WIRE file and try to understand the flow.