Page 1 of 1

Custom Template: Conditional Hide

Posted: Fri Oct 11, 2013 9:26 pm
by mpol_ch

I am using the following code in Page_Load to hide certain columns for add pages with "custom template".

if ((CurrentUserLevel() == 1)) {
$this->bugos->Visible = FALSE;
}

It works. But the entire row of custumized table is remaining with the following error:
#tpx_bugs_bugos

What I am doing wrong?

thanks
mpol_ch


Re: CustomTemplate: Conditinal Hide

Posted: Sat Oct 12, 2013 9:34 am
by danielc

Use:
<?php if yourcodition { ?> {{{yourfield}}} <?php } ?> to display your field or not in custom template.


Re: Custom Template: Conditional Hide

Posted: Sat Oct 12, 2013 7:24 pm
by mpol_ch

Hallo danielc
Which kind of condition should be places in the customtemplate? Is it the same as I inserted in Page_Load?

mpol_ch


Re: Custom Template: Conditional Hide

Posted: Sun Oct 13, 2013 6:28 pm
by danielc

The condition is: if CurrentUserLevel is not equal to 1, {{{yourfield}}} will display.


Re: Custom Template: Conditional Hide

Posted: Fri Oct 20, 2017 12:12 am
by sangnandar

Page_Load()
// Do whatever condition to set Visible value

Custom Template:
<?php if (CurrentPage()->field->Visible) { ?>{{{field}}}
<?php } ?>

If Visible value set TRUE on Page_Load(), it will display on Custom Template.