Add two fields in NodeBB
-
@psychobunny Please see the line 320 in the file. Try to get in the console:
console.log (res.locals.isAPI)
.
If reload category page:undefined
If back and next to the category page:true
-
Yeah that makes sense. So how NodeBB works is we have rendering on both client-side and server side. This is for maximum SEO potential, ability to render on JS-disabled browsers, and just plain speed.
So in that middleware, we check if you're cold-loading (thus isAPI is not set) or if you're requesting just the data for the page from ajaxification (isAPI is set). Basically if isAPI is not set we render the whole thing on server with the header and footer and send it over to client.
-
@psychobunny What should I do to make it work in the template category?:
<!-- IF content --> <div class="content"> \{content\} </div> <!-- ENDIF content -->
-
@psychobunny said:
Sorry, I didn't understand the last thing that you said?
I need to worked in the template
\{content\}
. Now it works, but only after refreshing the page. -
@psychobunny I realized what was happening. This issue is relevant only in conjunction to one's options my browser probably sessions or cookies, I try to understand.
-
But there is another problem. If this sub-category, and if do not set
content
her, in tag\{content\}
is substituted\{parent.content\}
. I can not find where to fix it. -
With
\{description\}
everything is fine. -
Can be removed
validator.escape()
from the line 166src/categories.js
file? -
@sergej-saveljev said:
But there is another problem. If this sub-category, and if do not set
content
her, in tag\{content\}
is substituted\{parent.content\}
. I can not find where to fix it.I solved the problem by adding the file
src/categories.js
line:if (!category.content) category.content = false;
-
Please tell me what to do, that be can use the template categories.tpl (ie on the main page) tag
\{content\}
?
-
I try to understand, but was be interesting to hear the views of developers.
-
I'm not 100% sure what you're asking about, can you rephrase please? (I'm sorry!)
-
I think he wants to add input fields to the acp for modifying/customising special escaped fields inside templates. But he's running into two problems: The escaped fields are being removed by validator.escape(), and he needs to know where to call replace for templates when they are sent via ajax.
-
@yariplus
validator.escape()
not particularly worried for me. If the above is not clear I written, me nothing to add -
@yariplus said:
I think he wants to add input fields to the acp for modifying/customising special escaped fields inside templates. But he's running into two problems: The escaped fields are being removed by validator.escape(), and he needs to know where to call replace for templates when they are sent via ajax.
if that's the case, then have a look at
admin/general/navigation
route, we escape language strings so it can be displayed in the input without looking like it's been escaped: -
@sergej-saveljev said:
Please tell me what to do, that be can use the template categories.tpl (ie on the main page) tag
\{content\}
?
I myself realized. Thanks to all!