How do I insert associative arrays in plugin templates?

NodeBB Development

Suggested Topics


  • How to make a plugin?

    NodeBB Development
    2
    0 Votes
    2 Posts
    284 Views
  • 1 Votes
    6 Posts
    590 Views

    I would imagine you would add what @baris mentioned in here:

    https://github.com/bubundas17/nodebb-plugin-hide-contents/blob/master/library.js#L19

    if user is member of the poster set, return content as is

  • 0 Votes
    5 Posts
    1k Views

    I'm seeing stack traces, but there's no indication of NodeBB starting up or stopping, so I don't know what's happening here. Could be memory exhaustion leading to the NodeBB process being killed?

  • 0 Votes
    2 Posts
    800 Views

    Looks like this problem is because of an error in my CSS file. So I have it to fix it myself.

  • 0 Votes
    6 Posts
    2k Views

    Sure.

    library.js

    Plugin = module.exports; var categories = require.main.require('./src/categories'); // init hook Plugin.init = function (data, callback) { var router = data.router; var middleware = data.middleware; // Create route to render the template to. router.get('/example-categories', middleware.buildHeader, renderExampleCategories); router.get('/api/example-categories', renderExampleCategories); function renderExampleCategories(req, res, next) { // Get all the visible categories. categories.getCategoriesByPrivilege('cid:0:children', req.uid, 'find', function(err, categoryData) { if (err) return next(err); // Put the categories in a tree format. categories.flattenCategories([], categoryData); // Send the data to the template. `example-categories.tpl` res.render('example-categories', {categories: categoryData}); }); } };

    example-categories.tpl

    <!-- BEGIN categories --> <a href="{config.relative_path}/category/{categories.slug}" itemprop="url">{categories.name}</a> <br> <!-- BEGIN categories.children --> - <a href="{config.relative_path}/category/{categories.children.slug}" itemprop="url">{categories.children.name}</a> <br> <!-- END categories.children --> <!-- END categories -->

    Should give you a list like this