Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Yesterday at 02:04 PM
-FP Posted April 23, 2015 Posted April 23, 2015 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?
opentype Posted April 23, 2015 Posted April 23, 2015 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}}
-FP Posted April 23, 2015 Author Posted April 23, 2015 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)
ABGenc Posted April 23, 2015 Posted April 23, 2015 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 ?
-FP Posted April 23, 2015 Author Posted April 23, 2015 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.
opentype Posted April 24, 2015 Posted April 24, 2015 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/
ABGenc Posted April 24, 2015 Posted April 24, 2015 Thanks @Ralf H. I will go through and hopefully start to get it..
-FP Posted April 24, 2015 Author Posted April 24, 2015 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.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.