Conditionals / BBcode

For support and discussion related to templates, themes, and imagesets in phpBB 3.2.
Post Reply
User avatar
EpicFawker
Registered User
Posts: 30
Joined: Wed Jan 13, 2016 3:13 am

Conditionals / BBcode

Post by EpicFawker » Mon May 29, 2017 12:52 pm

Ok so..

I'm trying to hide [ code] from guests, but not from normal members.

I have tried this (bbcode.html):

Code: Select all

<!-- IF not S_USER_LOGGED_IN -->

You must log in.

<!-- ELSE IF S_user_LOGGED_IN -->

<!-- BEGIN code_open --><div class="codebox"><p>{L_CODE}{L_COLON} <a href="#" onclick="selectCode(this); return false;">{L_SELECT_ALL_CODE}</a></p><pre><code><!-- END code_open -->
<!-- BEGIN code_close --></code></pre></div><!-- END code_close -->

<!-- ENDIF -->
The message seems to be displayed under the code box but does not hide the code box, so what am i doing wrong here :?
Last edited by Hanakin on Tue May 30, 2017 11:01 am, edited 2 times in total.
Reason: Topic icon changed

User avatar
Hanakin
Front-End Dev Team Lead
Front-End Dev Team Lead
Posts: 891
Joined: Wed Dec 30, 2009 8:14 am
Name: Michael Miday
Contact:

Re: Conditionals / BBcode

Post by Hanakin » Mon May 29, 2017 3:01 pm

try this in style.cfg found in the prosilver folder change

# template_bitfield = lNg=

to

# template_bitfield = //g=

and see if this works?
Donations welcome via Paypal Image

User avatar
EpicFawker
Registered User
Posts: 30
Joined: Wed Jan 13, 2016 3:13 am

Re: Conditionals / BBcode

Post by EpicFawker » Mon May 29, 2017 4:34 pm

Hanakin wrote:
Mon May 29, 2017 3:01 pm
try this in style.cfg found in the prosilver folder change

# template_bitfield = lNg=

to

# template_bitfield = //g=

and see if this works?
Thanks for the reply, i tried this and it didn't work. I am curious though what is the difference between 2 bitfields is there documentation on this somewhere? I am using Milk btw from https://themeforest.net/item/milk-multi ... e/16119149 not sure if this makes a difference. I did edit both templates proSilver and Milk.

User avatar
JoshyPHP
Code Contributor
Posts: 999
Joined: Mon Jul 11, 2011 12:28 am

Re: Conditionals / BBcode

Post by JoshyPHP » Mon May 29, 2017 6:29 pm

bbcode.html is not really a template file even if it looks like one.

On the other hand, I think you should be able to do something like that:

Code: Select all

<!-- BEGIN code_open --><xsl:choose><xsl:when test="$S_USER_LOGGED_IN"><div class="codebox"><p>{L_CODE}{L_COLON} <a href="#" onclick="selectCode(this); return false;">{L_SELECT_ALL_CODE}</a></p><pre><code><!-- END code_open -->
<!-- BEGIN code_close --></code></pre></div></xsl:when><xsl:otherwise>You must log in.</xsl:otherwise></xsl:choose><!-- END code_close -->
Last edited by JoshyPHP on Mon May 29, 2017 8:03 pm, edited 1 time in total.
I wrote the thing that does BBCodes in 3.2.

User avatar
EpicFawker
Registered User
Posts: 30
Joined: Wed Jan 13, 2016 3:13 am

Re: Conditionals / BBcode

Post by EpicFawker » Mon May 29, 2017 7:56 pm

JoshyPHP wrote:
Mon May 29, 2017 6:29 pm
bbcode.html is not really a template file even if it looks like one.

On the other hand, I think you should be able to do something like that:

Code: Select all

<!-- BEGIN code_open --><xsl:choose><xsl:when test="$S_USER_LOGGED_IN"><div class="codebox"><p>{L_CODE}{L_COLON} <a href="#" onclick="selectCode(this); return false;">{L_SELECT_ALL_CODE}</a></p><pre><code><!-- END code_open -->
<!-- BEGIN code_close --></code></pre></div></xsl:when><xsl:otherwise>You must log in.</xsl:otherwise></xls:choose><!-- END code_close -->
Caused an issue:

Code: Select all

Fatal error: Uncaught exception 's9e\TextFormatter\Configurator\Exceptions\InvalidXslException' with message 'Opening and ending tag mismatch: choose line 1 and choose ' in /home/xxxxxxxx/public_html/vendor/s9e/text-formatter/src/Configurator.php:1949 Stack trace: #0 /home/xxxxxxxx/public_html/vendor/s9e/text-formatter/src/Configurator.php(5084): s9e\TextFormatter\Configurator\Helpers\TemplateHelper::loadTemplate('<xsl:choose><xs...') #1 /home/xxxxxxxx/public_html/phpbb/textformatter/s9e/factory.php(483): s9e\TextFormatter\Configurator\TemplateNormalizer->normalizeTemplate('<xsl:choose><xs...') #2 /home/xxxxxxxx/public_html/phpbb/textformatter/s9e/factory.php(272): phpbb\textformatter\s9e\factory->get_default_bbcodes(Object(s9e\TextFormatter\Configurator)) #3 /home/xxxxxxxx/public_html/phpbb/textformatter/s9e/factory.php(376): phpbb\textformatter\s9e\factory->get_configurator() #4 /home/xxxxxxxx/public_html/phpbb/textformatter/s9e/renderer.php(97): phpbb\textformatter\s9e\factory->regenerate() #5 [internal function]: phpbb\text in /home/xxxxxxxx/public_html/vendor/s9e/text-formatter/src/Configurator.php on line 1949

User avatar
JoshyPHP
Code Contributor
Posts: 999
Joined: Mon Jul 11, 2011 12:28 am

Re: Conditionals / BBcode

Post by JoshyPHP » Mon May 29, 2017 8:04 pm

There's a typo, xls:choose instead of xsl:choose. I edited the post above the fix it.
I wrote the thing that does BBCodes in 3.2.

User avatar
EpicFawker
Registered User
Posts: 30
Joined: Wed Jan 13, 2016 3:13 am

Re: Conditionals / BBcode

Post by EpicFawker » Mon May 29, 2017 8:08 pm

This worked, thanks so much ;)

Feel free to look this topic @mods!

Post Reply

Return to “[3.2.x] Styles Support & Discussion”