plugins.registerHook removed, use plugins.hooks.register
plugins.unregisterHook removed, use plugins.hooks.unregister
plugins.fireHook removed, use plugins.hooks.fire
plugins.hasListeners removed, used plugins.hooks.hasListeners
Problem with 0.9 version and subcategories on main page
Hi, I have a little problem with new nodebb 0.9 version.
On my forum I show the subcategories on the main page, so that people can see the whole forum:
With the new version, I get that error (and it stop working):
13/11 00:31  - error: RangeError: Maximum call stack size exceeded
Looks like something is wrong, now, but I don't get why
@ffmad it's because of a change in the way templates.js processes conditionals in theme template files. Make sure the conditionals in your theme are in proper format.
If you have a condition like this
<!-- IF categories -->
Make sure there is a space after
<!--and there is a space before
If you have a custom theme make sure you don't have any invalid syntax in the templates. Specifically check for whitespace missing in
<!-- BEGIN someArray -->and
<!-- IF someCondition -->blocks.
^^ what he said
Is there a problem in this code ?
<div class="subcategories-list col-md-12 col-sm-12 col-xs-12"> <div class="col-md-6 col-sm-9 col-xs-12 content"> <!-- IF ../children.length --><p>[[category:subcategories]]</p><!-- ENDIF ../children.length --> </div> <!-- BEGIN ../children --> TEST <!-- END ../children --> </div>
the IF is working well, but the begin/end isn't
edit: it really is a syntax problem, as it's still not working even with no subcategories
RangeError: Maximum call stack size exceeded at String.match (native) at checkConditional (/var/www/html/CryptoFR-v3.3/node_modules/templates.js/lib/templates.js:221:26) at checkConditionals (/var/www/html/CryptoFR-v3.3/node_modules/templates.js/lib/templates.js:217:27) at parseValue (/var/www/html/CryptoFR-v3.3/node_modules/templates.js/lib/templates.js:383:14) at parse (/var/www/html/CryptoFR-v3.3/node_modules/templates.js/lib/templates.js:402:17) at cleanup (/var/www/html/CryptoFR-v3.3/node_modules/templates.js/lib/templates.js:473:27) at parse (/var/www/html/CryptoFR-v3.3/node_modules/templates.js/lib/templates.js:419:15) at cleanup (/var/www/html/CryptoFR-v3.3/node_modules/templates.js/lib/templates.js:473:27) at parse (/var/www/html/CryptoFR-v3.3/node_modules/templates.js/lib/templates.js:419:15) at cleanup (/var/www/html/CryptoFR-v3.3/node_modules/templates.js/lib/templates.js:473:27)
solved it ... by putting the code in an other template ... I still don't understand why, but it works
Let us know what the new code looks like
This is cool as heck, could you share the code used to achieve this? I'm interested in having this on my forum as well
Let us know what the new code looks like
In fact, it's still not working ...
I've moved the code to "item", but there even if it's displayed, there is still the same error in the console, and it breaks other pages
When it works, I can do that ^^
In a former version (0.7.0 I think), I've made a change so that the subcategories were showing as unread or not. Not working since 0.8.2, but that something I will try to put back online again
(my test website: http://22.214.171.124/)
@ffmad I'd be intrested in know how you have done that as well, as the only way I found to do it in 0.7.1 was to hack the categories.js file around, now that has changed in 0.9.0
@ffmad Looking good
I add the following code to item.tpl of persona
<!-- IF ../children.length -->
<!-- BEGIN ../children -->
<!-- END ../children -->
<!-- ENDIF ../children.length -->
but it produces this error error: RangeError: Maximum call stack size exceeded
please help me check
I've just downgrade template.js in nodebb to 0.2.8 then it works
@thuanpq-io No need to wrap it in conditional,
BEGINwon't do anything if the array is empty.
won't do anything if the array is empty
I guess the problem is that latest release of template.js does not allow another the loop inside a template, then I have to declare that loop in another template and include into my item.tpl