Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
Gill Posted June 19, 2018 Posted June 19, 2018 Hi Guys :) On my site I have two forum 1 and forum 2. Under Forum 1 there are 15 another subforums. I would to like to hide author name tumbnail next to topic Title only for Forum 1 and all its subforums not for Forum 2. I am trying to implement this by Html Logic MY Problem is i have to put every 15 forums ids inside the code to work it properly. right now i am looking for single global variable that is shared by a forum and its subforums so it with single line of code it works
Mark Posted June 19, 2018 Posted June 19, 2018 {{if $forum->id == X or $forum->parent_id == X}} Or if you want to make it infinitely recursive (so it also extends to subforums of subforums of forum A): {{if $forum->id == X or $forum->isChildOf( \IPS\forums\Forum::load( X ) )}} That will have a non-negligable performance hit though (it will increase linearly with how deep the forum is)
Gill Posted June 21, 2018 Author Posted June 21, 2018 Hi @Mark Thanks for reply :) I am trying to implement your suggested method to Remove the Topic Author details Box only for one specific forum and its subforums not for other forums. For other forums and its subforums topic author detail box is shown as first comment Id of a Forum for what i would like to implement is 5 i put following code inside Forums -> Front -> Topics -> PostContainer to implement my scenario {{if ! $comment->mapped('first') and ($forum->id == 5 or $forum->parent_id == 5)}} <aside class='ipsComment_author cAuthorPane ipsColumn ipsColumn_medium ipsResponsive_hidePhone'> <h3 class='ipsType_sectionHead cAuthorPane_author ipsType_blendLinks ipsType_break'><strong>{$comment->author()->link( $comment->warningRef() )|raw}</strong> <span class='ipsResponsive_showPhone ipsResponsive_inline'> {template="reputationBadge" group="global" app="core" params="$comment->author()"}</span></h3> <ul class='cAuthorPane_info ipsList_reset'> {{if $comment->author()->member_title && $comment->author()->member_id}} <li class='ipsType_break'>{$comment->author()->member_title}</li> {{elseif $comment->author()->rank['title'] && $comment->author()->member_id}} <li class='ipsType_break'>{$comment->author()->rank['title']}</li> {{endif}} {{if $comment->author()->rank['image'] && $comment->author()->member_id}} <li>{$comment->author()->rank['image']|raw}</li> {{endif}} <li class='cAuthorPane_photo'> {template="userPhoto" app="core" group="global" params="$comment->author(), 'large', $comment->warningRef()"} </li> <li>{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><img src='{file="$comment->author()->group['g_icon']" extension="core_Theme"}' alt='' class='cAuthorGroupIcon'></li> {{endif}} {{if $comment->author()->member_id}} <li>{template="reputationBadge" group="global" app="core" params="$comment->author()"}</li> <li class='ipsType_light'>{lang="member_post_count" pluralize="$comment->author()->member_posts"}</li> {{if $comment->author()->reputationImage()}} <li class='ipsPad_half'> <img src='{file="$comment->author()->reputationImage()" extension="core_Theme"}' title='{{if $comment->author()->reputation()}}{$comment->author()->reputation()}{{endif}}' alt=''> </li> {{endif}} {template="customFieldsDisplay" group="global" app="core" params="$comment->author()"} </ul> </aside> {{endif}} But it is not working could you please help me. I am just beginner in programming thanks
Nathan Explosion Posted June 21, 2018 Posted June 21, 2018 The reason it isn't working is because in postContainer, there is no $forum variable declared: So this cannot evaluate..... {{if ! $comment->mapped('first') and ($forum->id == 5 or $forum->parent_id == 5)}} EDIT: This will get you the forum id of a post in a topic in a forum: $comment->item()->container()->id This will get you the parent forum id of a post in a topic in a subforum: $comment->item()->container()->parent_id This should work for you: {{if(!$comment->mapped('first') AND ($comment->item()->container()->id === 2 OR $comment->item()->container()->parent_id === 2))}} {{endif}}
bfarber Posted June 22, 2018 Posted June 22, 2018 There is no $forum variable in that template. Instead use {{if ! $comment->mapped('first') and ($item->container()->id == 5 or $item->container()->parent_id == 5)}}
Gill Posted June 22, 2018 Author Posted June 22, 2018 @bfarber @Nathan Explosion Hi Guys :) Thanks a lots for Reply, Both solution works for me :) @Nathan Explosion Thanks again to help me again ?
Recommended Posts
Archived
This topic is now archived and is closed to further replies.