Skip to content

Further Widgets question

Solved Configure
  • Continuing my Widgets struggle here as although I asked about it on NodeBB forum, I still have remaining areas of confusion.
    I dont find the menu intuitive. In particular now Ive understood that the global .tpl will apply everywhere, are these Category / Topic settings irrelevant?
    20230526_163355~2.jpg

    Excuse the blurry photo, but what is the point of that
    Category 0
    Topic 0
    If its going to apply globally anyway?

  • @Panda is there any reason not to include a screenshot rather than a photo of the screen? It’s a bit hard to decipher a blurry image 🙂

  • Apologies, was having technical difficulties with laptop with no PrtSrn button!
    widget.png

    Update
    There are tpl files for category and categories
    It seems this field works under category.tpl and not categories.tpl

    Im confused what the categories.tpl is for, but the category.tpl is working now, so problem solved

  • Pandaundefined Panda has marked this topic as solved on
  • @Panda category is for a category in its own, so for example, “fruit” whereas categories is the page that contains all categories as a list.


Did this solution help you?
Did you find the suggested solution useful? Why not buy me a coffee? It's a nice gesture, and a great way to show your appreciation 💗

  • 3 Votes
    5 Posts
    154 Views

    @crazycells Agreed. It takes a more sensible approach. Nobody ever upvotes the first post - it’s usually much further down as the conversation progresses.

  • 2 Votes
    26 Posts
    1k Views

    @Panda said in Interesting Widget code, but can’t fetch API:

    How did you drop that widget into the post there?
    I hadnt seen this BSgenerator anywhere on sudonix site, do you use it somewhere already?

    Yes, here

    https://sudonix.org/topic/414/corporate-bullshit-generator?_=1687774393044

    It’s not a “post” or “topic” in the common sense. It is actually a page in it’s own right and leverages nodebb-plugin-custom-pages. This in turn creates a new “route” which behaves like a page, meaning it is then exposed for widgets.

    @Panda said in Interesting Widget code, but can’t fetch API:

    Also can you explain more what you mean by calling the code externally. In my API call example, how would I go about doing that?

    By this, I mean create all the required code in an external JS file that is reachable by the NodeBB instance - so, in “public” for example - or in my case /public/js. The widget then “calls” that file and because it runs outside of the scope of NodeBB, you just need to return the values to the widget.

    Hope this makes sense?

  • 5 Votes
    16 Posts
    437 Views

    @DownPW Yes, it is. It’s set far too low meaning other elements with a higher preference will sit over the top of it.

  • Where are widgets stored?

    Solved Configure
    3
    1 Votes
    3 Posts
    171 Views

    @phenomlab Thanks, have DMed you

  • Smart Widgets

    Solved Configure
    9
    3 Votes
    9 Posts
    316 Views

    @Panda said in Smart Widgets:

    So why is that, or conversely why would the function to expose username ever be required, as it seems app.user is already an available global object?

    It is, yes, but not if you are using it outside of a widget. The function I wrote is also historical and comes from the 2.x train 🙂

  • 4 Votes
    8 Posts
    335 Views

    @Panda said in Upgrade to NodeBB v3? 2BB or not 2BB, that is the question!:

    So although thats a plugin it has Widget like element and stopped working on the Theme change

    Which is normal based on the widgets being reset when you change themes.

  • Chevron up before & after

    Solved Configure
    11
    4 Votes
    11 Posts
    383 Views

    @crazycells you are right 🙂 thank you.

  • 7 Votes
    7 Posts
    427 Views

    @phenomlab thank you very much 🙂