Custom Template: Conditional Hide

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
mpol_ch
User
Posts: 877
Location: Switzerland

Custom Template: Conditional Hide

Post 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


danielc
User
Posts: 1601

Post by danielc »

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


mpol_ch
User
Posts: 877
Location: Switzerland

Post 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


danielc
User
Posts: 1601

Post by danielc »

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


sangnandar
User
Posts: 980

Post 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.


Post Reply