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

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

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

asp.net mvc - breakpoint on javascript in CSHTML? -