TinyButStrong - the PHP Template Engine
Categories > TinyButStrong general >

Hide a page based on a PHP variable

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs

By: olly
Date: 2015-11-05
Time: 17:27

Hide a page based on a PHP variable

Is it possible to hide a one or many pages by specifying a php variable?
ie hide page 2 if $page2 = no;

Have been searching for an example of this but haven't been able to find much.

Thanks in advance,
Olly

By: Skrol29
Date: 2015-11-05
Time: 22:12

Re: Hide a page based on a PHP variable

What kind of template is it ?
By: olly
Date: 2015-11-06
Time: 11:56

Re: Hide a page based on a PHP variable

DOCX template.
So it wasn't as difficult as I thought.
I  just put this [onload;block=tbs:page;when [var. page2_hide]=0] and had the php variable $page2_hide= 1;

Only issue I have is it doesn't seem to work on the last page of the template. Do I have to close the page with something?
By: Skrol29
Date: 2015-11-07
Time: 00:10

Re: Hide a page based on a PHP variable

The doc says :

« Knowed bug for DOCX: the TBS tag using the alias tbs:page must not be placed in the last paragraph of the page when the page-break in done with an inserted page-break.
Use the page-break property of the paragraph instead, or move the TBS tag in another paragraph. »