Save a value in the database and retrieve the value

  • Thread starter Thread starter Deleted member 10469
  • Start date Start date
D

Deleted member 10469

Guest
Hello, I would like to know how to create a field in the admin panel, save a value in the database and retrieve the value please :)

This is just to record information "on" or "off" in the database (button on/off) and enable or disable elements accordingly.
 
I'm not exactly sure I fully understand...

But you can create Options in the Admin CP.

You'd want to create an option, give it a unique ID, a title, type on/off checkbox, value boolean, default value either 1 or 0. (1 for on, 0 for off).

So if you give it an ID of myCheckBox then you can reference that in a template using:

{$xenOptions.myCheckBox}

You can check if it's on or off...

<xen:if is ="{$xenOptions.myCheckBox}">
Do stuff if checkbox on
<xen:else />
Do stuff if checkbox off
</xen:if>

Or you can just check if it's on:

<xen:if is ="{$xenOptions.myCheckBox}">
Do stuff if checkbox on
</xen:if>

Or check if it's off:

<xen:if is ="!{$xenOptions.myCheckBox}">
Do stuff if checkbox off
</xen:if>
 
Ok thank you very much, XenForo is very intuitive that side! :)

I have another question, is it possible to outsource its addon to share?

Example:

MySkin.rar
- Upload
- XenCreaSkin
- XenCreaAddon (Is it possible to export my addon ?)

Thank for help :)
 
Top Bottom