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

Default value for data type array

SchmitzIT

Well-known member
#1
So, where culd I find some additional information on how to use/implement the default values when using arrays and relying on a template to create the display?

XenForo has it implemented, for instance, in the Terms of Service option. optionID = tosUrl, which in turn relies on admin template option_template_tosUrl to display three options, with the third one showing a textbox to enter a custom value.

The default value shown for this is:

Code:
a:2:{s:4:"type";s:7:"default";s:6:"custom";b:0;}
How would I translate that into something meaninful, exactly? What does the a represent, what does the s represent, and what does the b represent? What about the numbers 2, 4, 7 and 6?

Thanks :)
 

SchmitzIT

Well-known member
#3
Sorry to revive this old of a thread, but I still seem to be having trouble with this, and would appreciate a bit more help.

Here's my admin_template:

Code:
<xen:radiounit label="{$preparedOption.title}" hint="{$preparedOption.hint}" name="{$fieldPrefix}[{$preparedOption.option_id}][type]">
    <xen:explain>{xen:raw $preparedOption.explain}</xen:explain>
    
    <xen:option label="{xen:phrase si_links_sidebar_location}" value="" selected="{$preparedOption.option_value.type} == ''" />
        
    <xen:option label="{xen:phrase si_links_footer_location}" value="default" selected="{$preparedOption.option_value.type} == 'default'" />

    <xen:option label="{xen:phrase si_links_header_location}" value="" selected="{$preparedOption.option_value.type} == ''" />
        
    <xen:html>
        <input type="hidden" name="{$listedFieldName}" value="{$preparedOption.option_id}" />
        {xen:raw $editLink}
    </xen:html>
</xen:radiounit>
My edit format has been set to Named Template, with Format Parameters pointing to the template above.

Data Type has been set to Array, with the default value field containing the following:

Code:
a:2:{s:7:"sidebar";s:7:"default";s:6:"header";}
The Arra Sub-Options contain the alues "sidebar" and "header", on seperate lines.

This ends up in the Header value being checked. Any clues as to why, or how I can change this?

Thanks in advance :)