Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted April 23, 20159 yr In 3.x IP.Content, this would work: <if test="!$record['custom_field_id']">In 4.x I see some stuff like "{{if $record->customFieldsForDisplay" or "$record->customFieldDisplayByKey", but I can't figure out how to test if there's anything in the field.Any ideas?
April 23, 20159 yr It’s so easy, you almost had it. You really just write this to test if there is content in the field …{{if $record->customFieldsForDisplay('display')['your-key']}} {{endif}}or if you know the field ID it’s even simpler:{{if $record->field_XXX}} {{endif}}
April 23, 20159 yr Author Cool, thanks. For some reason it didn't work using 'display', but I changed it to 'raw' and it worked. (My articles have a custom field to store a topic ID, and I show a link to the topic only if there's an ID stored in the field)
April 23, 20159 yr Sorry for my ignorance. I am trying to understand this language but can not find a doc. Any reference I can read to understand this ?
April 23, 20159 yr Author Sorry for my ignorance. I am trying to understand this language but can not find a doc. Any reference I can read to understand this ?I was looking for that earlier before starting this topic but I didn't find anything, well there's this http://community.invisionpower.com/4docs/, but it doesn't have anything about pages templates coding, hopefully they will add more information there.
April 24, 20159 yr Well, the original question would have been answered here:http://community.invisionpower.com/4docs/advanced-usage/development/template-logic-r73/That’s also useful:http://community.invisionpower.com/4docs/advanced-usage/development/template-tags-r76/
April 24, 20159 yr Author Oh yep I saw that, but honestly... well I'm not a programmer and I do most of my stuff searching around, reverse-engineering existing code, trying, copying and pasting, getting errors, trying again, getting more errors, until something works...What I mean is that I would never get to the code I needed with this "{if $foo}}" or "{$foo|raw}" as the examples. I meant to say that I hope they add more "real-life" examples rather than just the logic behind it.
Archived
This topic is now archived and is closed to further replies.