Using category specific conditionals on template
-
Is it possible to use
<!--IF cid.1 -->
? or something like this in the category.tpl
I'm sure this wouldn't be the right way to do it, but yeah... -
@julian said:
Hm... we don't support evaluation of conditionals in our templating engine, and I think you'd be hard pressed to find it in any others (though I could be wrong!)
Ahh okay, it makes sense. It was just a thought, that's all. I can think of a few uses for it but meh. Really not that important I don't think.
-
logical operators templates.parse support · Issue #1065 · NodeBB/NodeBB
if would be nice if you can just evaluate the expression in JS if truthy or not
GitHub (github.com)
-
@baris Thanks for the reference. So how would I use this for example?
-
Coming soon
-
@julian said:
Hm... we don't support evaluation of conditionals in our templating engine, and I think you'd be hard pressed to find it in any others (though I could be wrong!)
hey julian - jinja templates for python are making extensive use of conditions, loops, exeptions...
maybe as an inspiration
jinja templating engine -
@trevor maybe this could be for interest: post indivual layout with {{cid}}
-
@Thomas-Krickl -- hehe, I have no doubt that it is possible, but I imagine the reason why it is not done in many templating engines is simply because the overhead of supporting that level of parsing makes the entire engine several orders of magnitude slower.
-
not to sure about that - i think it depends on what you are doing or you want to achieve.
in flask you are loading for example a bunch of data as json dicts and pass them like the are on to the template - there you have a for loop which extracts the fields you need for every entry and generate the template. i think that this is a very fast way to do it and it's very easy and simple to write the template.
otherwise you would have to make a template sigular for one db entry and open it for every entry you want to display and fetch it into the main layout...but to be honest - i haven't jet read your source because i'm very new to this forum and node... maybe i'm wrong
-
@Thomas-Krickl said:
@trevor maybe this could be for interest: post indivual layout with {{cid}}
That's what I recommended, lol and this is for something totally different that what I am asking.