XF 2.2 How to hide a widget using display conditions on a specific page?

Ferry

Member
Hi,
Looks like I'm making a mistake somewhere in the display condition.
I need to hide a widget from multiple pages, but nothing works.

If I use
Code:
$xf.reply.template !== 'whats_new'
it works.
But when trying to add another page nothing works
Code:
$xf.reply.template !== 'whats_new, whats_new_profile_posts'

What am I doing wrong?
 
I did something like this for a widget that I wanted to show certain things from depending on the situation. You may be able to adapt it for what you want: Edit! Ninjad in solution post lol

Code:
<xf:foreach loop="$threads" value="$thread">
                                <xf:if is="in_array($thread.node_id, [2,3,4,5,6,7,8,9])">
                            <li class="block-row">
                                <a href="{{ link('threads', $thread) }}" rel="nofollow"><img class="moviePoster" src="https://image.tmdb.org/t/p/w342{$thread.Movie.tmdb_image}"/></a>
                                <xf:macro template="thread_list_macros" name="item_new_threads"
                                    arg-thread="{$thread}" />
                            </li>
                                   
                                    </xf:if>
                                <xf:if is="in_array($thread.node_id, [21,22,23,24,25,26,27,28])">
                            <li class="block-row">
                                <a href="{{ link('threads', $thread) }}" rel="nofollow"><img class="tvPoster" src="{$thread.TV.getImageUrl('l')}" /></a>
                                <xf:macro template="thread_list_macros" name="item_new_threads"
                                    arg-thread="{$thread}" />
                            </li>
                                    </xf:if>
                        </xf:foreach>
 
I did something like this for a widget that I wanted to show certain things from depending on the situation. You may be able to adapt it for what you want:

Code:
<xf:foreach loop="$threads" value="$thread">
                                <xf:if is="in_array($thread.node_id, [2,3,4,5,6,7,8,9])">
                            <li class="block-row">
                                <a href="{{ link('threads', $thread) }}" rel="nofollow"><img class="moviePoster" src="https://image.tmdb.org/t/p/w342{$thread.Movie.tmdb_image}"/></a>
                                <xf:macro template="thread_list_macros" name="item_new_threads"
                                    arg-thread="{$thread}" />
                            </li>
                                   
                                    </xf:if>
                                <xf:if is="in_array($thread.node_id, [21,22,23,24,25,26,27,28])">
                            <li class="block-row">
                                <a href="{{ link('threads', $thread) }}" rel="nofollow"><img class="tvPoster" src="{$thread.TV.getImageUrl('l')}" /></a>
                                <xf:macro template="thread_list_macros" name="item_new_threads"
                                    arg-thread="{$thread}" />
                            </li>
                                    </xf:if>
                        </xf:foreach>
Appreciated it, it might be useful for the future
 
That's not the correct syntax.

Thanks so much for the proper code!

My variation on this is that I have four widgets that I'd like to hide a handful of pages. The widgets are pretty standard stuff (new posts from two forrums, some super basic custom HTML using the built-in tools, etc), but I don't want them showing on

/approval-queue
/reports
/members
or anything after /account (preferences, privacy, etc.)

So would it be better to try to do this in the page templates, or in the Display condition of the individual widgets?

Thanks!
 
Back
Top Bottom