XF 2.0 Can a widget be inserted INSIDE a post via the front end? (like bbcode)

RobParker

Well-known member
I assume the answer is no and instead we need to put conditionals inside the template but I was wondering if it's possible to insert a widget inside a post if you have the right permissions?
 
Not inside a post as such.

Like I can’t just enter some BB code to make a widget appear.

Also we don’t have any built in widget positions for that either.

But you can assign a widget to no position and then use some XF template syntax inside any template. So effectively you can put a widget anywhere as long as you can edit a template.
 
With a little bit of code you can, but that won't do what you want to achieve:
BB codes support PHPcallbacks, so you could create a class that renders a widget and use that as a callback for your BB code.
But that would render the widget when the BB code is compiled to HTML, not when the resulting HTML is being displayed.

Edit
Actually it seems like this might just work, there does not seem to be a bbcode parse cache in XF2 any longer?
 
Last edited:
Cheers

What I was looking for was to do something like this:

We have a widget that displays some data (that changes).
When someone creates a new post for this topic (which happens say weekly), we'd like the widget to be displayed in the post.
Ideally, whoever creates the post would be able to insert the widget rather than relying on us editing the template/conditionals to just add it to that post each time.
What I was hoping for was something like [widget]<widget_key>[/widget] and the widget would magically display.
 
Cheers

What I was looking for was to do something like this:

We have a widget that displays some data (that changes).
When someone creates a new post for this topic (which happens say weekly), we'd like the widget to be displayed in the post.
Ideally, whoever creates the post would be able to insert the widget rather than relying on us editing the template/conditionals to just add it to that post each time.
What I was hoping for was something like [widget]<widget_key>[/widget] and the widget would magically display.


I'm in need of the same feature. Has anyone figured out how to achieve this? Is there an addon that will enable this feature?
 
Top Bottom