• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Check boxes example?

I've been searching for one, I'm trying to work with check boxes in the options however I'm not finding much information on usage for it.

Anyone have an example for it?
@Brogan you're like my XenForo parent. You always seem to be the one to help me! :whistle:(y):love:

Okay, so I'm seeing this.
I know this is serialized, although I don't have a key to tell me what means what.
Converted it looks like...
array (
  'showStaff' => '1',
  'displayMultiple' => '1',
  'hideUserTitle' => false,
  'showStaffAndOther' => false,
So is there a real difference between s:1:"1" and b:0? Well I would think b is a boolean so to match it would be b:1.

So in code I would do something like
if($options->formatParameter.myCheckbox) { }
As long as the default value is...
And my Array suboptions are just "myCheckbox"?

Also, what about naming them? I know with other stuff you can put
option = {xen: phrase myPhrase}
So what about with check boxes?

Thanks again @Brogan
I'm trying to catch on quickly here.


XenForo moderator
Staff member
For the values, s is string and i is integer.
So these two would be the same:
  • s:1:"1";
  • ;i:1;
In the template you use options like so:
<xen:if is="{$xenOptions.optionId.optionValue}">
In PHP like so:
$options = XenForo_Application::getOptions();
if ($options->optionId['optionValue'])
if (XenForo_Application::getOptions()->optionId['optionValue'])
Phrases can be used for labelling checkboxes and radio buttons.