SilverStripe: make a piece of HTML optional in page -


i not sure how , cant find example on silverstripe site.

i want make checkbox in cms field list. when checked page display code block have. when not checked not.

in page.ss have like:

<% if $showprintbutton %>     $showprintbutton <% end_if %> 

here relevant code

private static $db = [     'showprintbutton' => 'boolean(1)' ];  private static $defaults = [     'showprintbutton' => true ];  public function getcmsfields() {     ...     $fields->addfieldtotab('root.main', checkboxfield::create('showprintbutton', 'allow printing page'));     ... } 

Comments

Popular posts from this blog

php - Passing multiple values in a url using checkbox -

compilation - PHP install fails on Ubuntu 14 (make: *** [sapi/cli/php] Error 1) PHP 5.6.20 -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -