I've achieved this result before with CSS (with some help from Bryce, possibly… I forget) — but this is simpler to put into a page. Nice work!
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server
I inserted.
----
[[include :snippets:if START |unique=1|type=equal|var1=%%author%%|var2=tsangk]]
**##red|Thanks to tsangk for this great snippet:##** [[[code:conditional-blocks]]]
[[include :snippets:if END]]
----
This results only in a source coding in the rendered output:
<div class="if-equal-1-formdata-hide if-equal-1-tsangk">
<p><strong><span style="color: red;">Thanks to tsangk for this great snippet:</span></strong> <a href="/code:conditional-blocks">conditional-blocks</a></p>
</div>
The css module inserted fpor Author: [[*user tsangk]]{ !!
Service is my success. My webtips:www.blender.org (Open source), Wikidot-Handbook.
Sie können fragen und mitwirken in der deutschsprachigen » User-Gemeinschaft für WikidotNutzer oder
im deutschen » Wikidot Handbuch ?
Hi Shane and Helmuti! Thanks for checking my new snippet out!
I just updated the documentation with a nestable version. It's experimental and may be unstable - but check it out!
@Helmuti: would it be better to include the horizontal rule in within the conditional block:
[[include :snippets:if START |unique=1|type=equal|var1=%%author%%|var2=tsangk]]
----
**##red|Thanks to tsangk for this great snippet:##** [[[code:conditional-blocks]]]
----
[[include :snippets:if END]]
EDIT: Oh.. you fixed it… nevermind :D
Kenneth Tsang (@jxeeno)
Sorry, but the template text is now ncouded in all your snippets….!
Service is my success. My webtips:www.blender.org (Open source), Wikidot-Handbook.
Sie können fragen und mitwirken in der deutschsprachigen » User-Gemeinschaft für WikidotNutzer oder
im deutschen » Wikidot Handbuch ?
You can always change to the %%fullname%% for action-live to show the inlcude only here…
ok - i changed it to the one selected page only :
[[include :snippets:if START |unique=1|type=equal|var1=%%name%%|var2=conditional-blocks]]
@@
Service is my success. My webtips:www.blender.org (Open source), Wikidot-Handbook.
Sie können fragen und mitwirken in der deutschsprachigen » User-Gemeinschaft für WikidotNutzer oder
im deutschen » Wikidot Handbuch ?
You might also want to make bind the code in "code blocks":
text above inserted with:
[[div class="code"]]
@@[[include :snippets:if START |unique=1|type=equal|var1=%%name%%|var2=conditional-blocks]]@@
@@**##red|Thanks to tsangk for this great snippet:##** [[[code:conditional-blocks]]]@@
@@[[include :snippets:if END]]@@
[[/div]]
Kenneth Tsang (@jxeeno)
You credit me too much!
I'm glad my SUO helped you build this framework :)
The clever thing about SUO was that you use the same include for the opening and closing code blocks via neglecting attributes in the closing block. Whilst the backend coding is compleximicated to manufacture, it makes coding for the end-user easier.
What a great snippet tsangk ! It's going to be part of fantastic applications, never before possible!
I echo James' comments: great work which I look forward to implementing.
Rob Elliott - Strathpeffer, Scotland - Wikidot first line support & community admin team.
I'll add another echo to the chamber. This looks really cool and I'm also looking forward to giving it a spin.
Thanks Kenneth!
Hi Kenneth,
Thanks again for the idea to use James Idea for such conditional comparisons!
I think it is time to write a new "blog" entry on the community-news about this snippet!
It works ..
Regards
Helmut
Service is my success. My webtips:www.blender.org (Open source), Wikidot-Handbook.
Sie können fragen und mitwirken in der deutschsprachigen » User-Gemeinschaft für WikidotNutzer oder
im deutschen » Wikidot Handbuch ?
"Advanced….One inside outside a module, the other may be nested with a module."
Sorry, the English here doesn't make sense. Must it be inside or must it be outside? I assume it's outside.
Rob Elliott - Strathpeffer, Scotland - Wikidot first line support & community admin team.
Yes thanks. Now off to try it :)
Rob Elliott - Strathpeffer, Scotland - Wikidot first line support & community admin team.
Hi Tsangk…
Imagen I want to use this on only one page, and also to better understand what you're doing… Would it be possible to give the code without the includes on one page…
A - S I M P L E - P L A N by ARTiZEN a startingpoint for simple wikidot solutions.
This is basically how it works:
[[module CSS]]
.if-equal-default{ display: none; }
.if-equal-VAR1{ display: block !important; }
[[/module]]
[[div class="if-equal-default if-equal-VAR2"]]
Hide content unless VAR1 = VAR2
[[/div]]
By default, the DIV block is hidden by the first statement .if-equal-default{ display: none; }. However, in the case when VAR1 = VAR2, the second line in the CSS module is matched, so the previous statement is overrided. The !important is actually redundant there, as CSS is processed line-by-line.
Let's say VAR1 was apple and VAR2 was banana, the code would render:
[[module CSS]]
.if-equal-default{ display: none; }
.if-equal-apple{ display: block !important; }
[[/module]]
[[div class="if-equal-default if-equal-banana"]]
APPLES ONLY!
[[/div]]
Therefore, the div won't be shown as by default (set by if-equal-default class), the div is not displayed.
Kenneth Tsang (@jxeeno)
Yes that is what I assumed it would be like… but what I am trying to understand is how did you get the var1 (apple) into the module listpages… that's what I'm after.
Have a look at http://feedback.wikidot.com/wish:780 … because you seemed to manage this
Have a look at http://community.wikidot.com/forum/t-462190/include-with-variable-acting-strange#post-1419497 because you seemed to manage this
A - S I M P L E - P L A N by ARTiZEN a startingpoint for simple wikidot solutions.