XF 1.3 (Solved) Desperate Xen Syntax Help Needed

HeadHodge

Active member
Hi Everyone,

I'm new to xen coding and need some desperate help for a project I'm working on.
I've got what I want it to do 90% figured out. But I JUST CAN'T figure out the last part.

For a new forum I created in the Node Tree in the AdminCP, I added the following to the Header Template Html (from the AdminCP):

{xen:raw $thread.customFields.1.fields.ReviewForm_Effect.field_value}
<br />

{xen:raw $thread.customFields.1.fields.ReviewForm_Effect.fieldChoices.Noticeable_Effect}
<br /><br />

They both work fine.
The field_value displays in the header as "Noticeable_Effect"
The Noticeable_Effect displays in the header as "Warning: Product has Very Noticeable Effects!"

But for the life of me, I simply can't figure out how to do:
{xen:raw $thread.customFields.1.fields.ReviewForm_Effect.fieldChoices[{$thread.customFields.1.fields.ReviewForm_Effect.field_value}}]}

No matter how many ways I try, when I try to save my change with this in it, I get a "SYNTAX ERROR" and I'm not able save the Header Template, let alone get it to work.

Any help would be VERY VERY VERY MUCH APPRECIATED
Thanks
HeadHodge
 
What are you trying to do with that? It almost looks like you're trying to use array notation... Array are accessed with a period. If you want to use a value as a key, use a period and then use curly braces with the variable:

HTML:
{xen:raw $thread.customFields.1.fields.ReviewForm_Effect.fieldChoices.{$thread.customFields.1.fields.ReviewForm_Effect.field_value}}

If you want them to appear side-by-side, you have to enter them separately...

So, what exactly are you trying to do?
 
What are you trying to do with that? It almost looks like you're trying to use array notation... Array are accessed with a period. If you want to use a value as a key, use a period and then use curly braces with the variable:

HTML:
{xen:raw $thread.customFields.1.fields.ReviewForm_Effect.fieldChoices.{$thread.customFields.1.fields.ReviewForm_Effect.field_value}}

If you want them to appear side-by-side, you have to enter them separately...

So, what exactly are you trying to do?
OMG Thanks for a reply.

These are variables from "Custom Fields add-on". I have a form that contains a radio button with three choices. The fieldChoice above is the array that contains the value of each choice (i.e. "Has No Effects", "Has Moderate Effects", "Has Extreme Effects"). The user picks the appropriate one on the radio button and the array id that the user selected is contained in the field "field_value" which in this case is the value "Noticeable_Effect". So I'm basically trying to access one element in an array to display their choice of "Warning: Product has Very Noticeable Effects!"
 
What are you trying to do with that? It almost looks like you're trying to use array notation... Array are accessed with a period. If you want to use a value as a key, use a period and then use curly braces with the variable:

HTML:
{xen:raw $thread.customFields.1.fields.ReviewForm_Effect.fieldChoices.{$thread.customFields.1.fields.ReviewForm_Effect.field_value}}

If you want them to appear side-by-side, you have to enter them separately...

So, what exactly are you trying to do?
P.S. Just tried the snippet you provided and still get "SYNTAX ERROR"
 
Wew!!!..... Finally found the magic sequence:

{$thread.customFields.1.fields.ReviewForm_Effect.fieldChoices.{$thread.customFields.1.fields.ReviewForm_Effect.field_value}}

I don't know where I was going wrong. Trying to use the [] instead of the .{}

So thanks for the snippet, that actually gave the idea to try it that way.

p.s. Wish I could find better documentation on how to do this. I have literally combed this site for two days straight, trying to find something, and was beginning to freak....
 
Back
Top Bottom