solved {if} statement - works in some templates not in others

PatriaCo
PatriaCo
@the-patria-company
8 years ago
349 posts
I am stumped. I used the form designer in the Create New Group form.

I added a group_intro_video (text, number) to store the ID of a YouTube video.

Then I added this {if} statement:
{if isset($group_intro_video) && $group_intro_video != null}
(Which works fine with another custom field I have set up in the profiles form.) But this statement is being ignored in the group template - item_detail.tpl.

Any thoughts?


--
The Patria Company - patriaco.com / quality-trades.com / a-t.life - doing Jamroom since v3

updated by @the-patria-company: 09/19/16 05:45:25PM
SteveX
SteveX
@ultrajam
8 years ago
2,584 posts
Luckily it's not possible that it is being ignored :)

Either $group_intro_video is not set, or it is not = null, or both.

What happens if you try one or the other?


--
¯\_(ツ)_/¯ Education, learning resources, TEL, AR/VR/MR, CC licensed content, panoramas, interactive narrative, sectional modules (like jrDocs), lunch at Uni of Bristol. Get in touch if you share my current interests or can suggest better :)
PatriaCo
PatriaCo
@the-patria-company
8 years ago
349 posts
No change.

When I {debug} I can see
$group_intro_video "52"

and it is listed in the $items array but my {if} statement doesn't work. (grrrrrrr)

Thanks for any and all help.


--
The Patria Company - patriaco.com / quality-trades.com / a-t.life - doing Jamroom since v3
PatriaCo
PatriaCo
@the-patria-company
8 years ago
349 posts
Ok, I am missing something, and it is probably something small.

I just confirmed that {$group_intro_video} is not "printing", for lack of a better term.

Although I can see it on the debug screen, when I set it in an area where it should just return the text. It fails.

Any ideas?


--
The Patria Company - patriaco.com / quality-trades.com / a-t.life - doing Jamroom since v3
michael
@michael
8 years ago
7,715 posts
spelling mistake.

Its not the {if} statement thats not working its the condition your asking it to check does not evaluate to true.

You're asking it a question, its doing the right thing. The information you're passing it must be wrong.

You're saying that {$group_intro_video} exists and contains "52" but the if statement not firing and it not printing are both calling you a liar. ;)

throw a screenshot of the debug up here and I'll see what I see.

Oh, and check that your {degbug} is written right next to that if statement. Could be that the location of the debug call is in a different template to where you're trying to use it.
paul
@paul
8 years ago
4,326 posts
Quote: and it is listed in the $items array but my {if} statement doesn't work. (grrrrrrr)
So shouldn't it be $item.group_intro_video or something like that?


--
Paul Asher - JR Developer and System Import Specialist
PatriaCo
PatriaCo
@the-patria-company
8 years ago
349 posts
That was it Paul! :) It is working now.

So why is it that my other custom field was able to be used as {$profile_family}, but this custom field required the $item. in front?


--
The Patria Company - patriaco.com / quality-trades.com / a-t.life - doing Jamroom since v3
paul
@paul
8 years ago
4,326 posts
When viewing profile templates there is just the one profile so any profile variables don't need to be part of an array, so that is whey they are available as their actual key value. If its a listing template that shows many groups, that's when they are an item in an array.
When working with templates alway do a {debug} call initially so as to see what variables (and their format) you have to play with.
hth


--
Paul Asher - JR Developer and System Import Specialist
PatriaCo
PatriaCo
@the-patria-company
8 years ago
349 posts
It is weird, because I could see both, but only the $item version worked.

Thanks again and thanks for the extra explanation. Lesson learned. :)


--
The Patria Company - patriaco.com / quality-trades.com / a-t.life - doing Jamroom since v3

Tags