XF 2.0 Call a widget in a notice

kankan

Well-known member
Hello
Is there any way to call a Widget in a Notice ?
I tried this :
Code:
<xf:if is="$xf.visitor.isMemberOf([3])">
    <xf:widget key="my_widget_id" />
</xf:if>
But content of the widget is not displayed in notice
Thank you
 
Last edited:
Hello
Is there any way to call a Widget in a Notice ?
I tried this :
Code:
<xf:if is="$xf.visitor.isMemberOf([3])">
    <xf:widget key="my_widget_id" />
</xf:if>
But content of the widget is not displayed in notice
Thank you
checked with this , xf tags are not working there but you can put html in there it works. I am still exploring if can find a way to do this
 
Bit of a workaround in the templates. Edit template "notice_macros"

Find:

Code:
    {$contentHtml|raw}


Add above/below your widget with a conditional check of the notice id:

Code:
            <xf:if is="$notice.notice_id =='2'">
                 <xf:widget key="forum_overview_forum_statistics" />
            </xf:if>



ymnp6OU.png

You'll need to apply some styling but it seems to be working.
 
Last edited:
Bit of a workaround in the templates. Edit template "notice_macros"

Find:

Code:
    {$contentHtml|raw}


Add in your widget with a conditional check of the notice id:

Code:
            <xf:if is="$notice.notice_id =='2'">
                 <xf:widget key="forum_overview_forum_statistics" />
            </xf:if>

Right above/below.


View attachment 247508

You'll need to apply some styling but it seems to be working.
this will be a static notice and need to every-time add one, but yes a solution.

Also do not edit the template directly use template modifications to edit the templates
 
this will be a static notice and need to every-time add one, but yes a solution.

Also do not edit the template directly use template modifications to edit the templates

What? Editing templates is perfectly acceptable for something like this.

Also, I'm assuming they want to add a widget to a specific notice. If they want it on every single notice, they can just remove the conditional.
 
Bit of a workaround in the templates. Edit template "notice_macros"

Find:

Code:
    {$contentHtml|raw}


Add above/below your widget with a conditional check of the notice id:

Code:
            <xf:if is="$notice.notice_id =='2'">
                 <xf:widget key="forum_overview_forum_statistics" />
            </xf:if>



View attachment 247508

You'll need to apply some styling but it seems to be working.
Thanks this is great, and actually answers my question here:

 
Back
Top Bottom