Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted January 16, 20232 yr I'm attempting to upgrade to the latest version of the forum software, so I'm porting over some of our customizations, but for some reason I can't get the theme to load a custom template file. In forums>front>topics>postContainer, on line 92, I've added an else condition to load a template bit: {{if !$comment->isAnonymous()}} <li data-role='group'>{expression="\IPS\Member\Group::load( $comment->author()->member_group_id )->formattedName" raw="true"}</li> {{if \IPS\Member\Group::load( $comment->author()->member_group_id )->g_icon }} <li data-role='group-icon'><img src='{file="$comment->author()->group['g_icon']" extension="core_Theme"}' alt='' class='cAuthorGroupIcon'></li> {{else}} <!-- this is the else --> {template="memberBadge" app="core" group="global" params="$comment->author()"} <!-- this is the template --> {{endif}} {{endif}} That template, memberBadge, resides under core>global>global. For whatever the reason, I can't get it to load, even if it's just static html in the template or text. If I put text like "test" under the else condition instead, I see it displayed under the member group name, but if I put nothing but that "test" text in the template, it doesn't display. This worked just fine in the old version, so I'm not sure what I'm missing.
January 16, 20232 yr Solution 38 minutes ago, Jyosua said: I'm attempting to upgrade to the latest version of the forum software, so I'm porting over some of our customizations, but for some reason I can't get the theme to load a custom template file. In forums>front>topics>postContainer, on line 92, I've added an else condition to load a template bit: {{if !$comment->isAnonymous()}} <li data-role='group'>{expression="\IPS\Member\Group::load( $comment->author()->member_group_id )->formattedName" raw="true"}</li> {{if \IPS\Member\Group::load( $comment->author()->member_group_id )->g_icon }} <li data-role='group-icon'><img src='{file="$comment->author()->group['g_icon']" extension="core_Theme"}' alt='' class='cAuthorGroupIcon'></li> {{else}} <!-- this is the else --> {template="memberBadge" app="core" group="global" params="$comment->author()"} <!-- this is the template --> {{endif}} {{endif}} That template, memberBadge, resides under core>global>global. For whatever the reason, I can't get it to load, even if it's just static html in the template or text. If I put text like "test" under the else condition instead, I see it displayed under the member group name, but if I put nothing but that "test" text in the template, it doesn't display. This worked just fine in the old version, so I'm not sure what I'm missing. app = core location = global group = global {template="memberBaddge" app="core" location="global" group="global" params="$comment->author()"} If you had it in core -> front -> global then your code would be fine as postContainer is in front too.
January 16, 20232 yr Author Yep, that was the issue. Thanks for the help! Is there somewhere in the dev docs where this is documented? I did some googling and skimming of the docs, but I didn't see anything that looked like it'd explain the full behavior of the template arguments. Edited January 16, 20232 yr by Jyosua
January 17, 20232 yr Author Thanks, this is exactly what I would have wanted. I wonder why there isn't a link to this part of the documentation from the getting started? I think it'd be good to direct people there if they want to read in further detail, since the title of that dev docs page doesn't really yell "templates!" to me.