Not a bug Add a widget key syntax in a template

  • Thread starter Thread starter Deleted member 184953
  • Start date Start date
D

Deleted member 184953

Guest
Hi, I hope I could be clear, not being very familiar with (simple...) addon development yet.

I'm trying to display a widget in a template using an option field.
My option id is wbn_widgetKey1 and in a template modification I put this: {$xf.options.wbn_widgetKey1}.

the field to be filled is configured as follows:
  • Edit format : Text box
  • Format parameters : left empty
  • Data type : string
If I populate the field with <xf:widget key="forum_overview_members_online" /> this widget is not displayed as a awidget but as a simple text...

Capture web_2-12-2022_22334_localhost.webp

What is the solution to this problem? I tried a lot of combinations (a bit haphazardly) but my skills are already at their limit here...
Thanks for your help.
 
if I look at the source code of the page I see it displayed like this : &lt;xf:widget key=&quot;forum_overview_members_online&quot; /&gt;
 
I did not imagine for a moment that it could be a bug but if it was I would be happy to have flushed it out.
 
Thx @K a M a L that's interesting.
Now the widget is no more displayed as text but it is not displayed at all despite the browser's inspector finding its code.

Capture d’écran 2022-12-03 003508.webp
 
Template syntax is compiled into PHP and as such this won't really work the way you anticipate. You may wish to use an option with a set of values instead and then use a template modification to switch the widget key based on that value.
 
Back
Top Bottom