News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

How to add costum theme settings for my newly created theme

Started by Pipke, October 11, 2016, 03:25:36 PM

Previous topic - Next topic

Pipke

As the title says, where to add theme settings or options, like in a mod, i want to create a theme that uses several settings other then the standard smf settings for the user and admins so they can save them(i.e. in profile or wherever), where do i have to add these code, cos themes dont use/have source folders, atleast i cant find any theme wich has it, if there is any i would really like to know, so i can take a peek how its done. Any help much appriciated.
"If something is wrong, fix it if you can. But train yourself not to worry: Worry never fixes anything."

Click here to view my mods for SMF

Hey 👋 Did i helped... you like what i do. You can now buy me a coffee! ☕

Vehement Works

Set arrays in Settings.template.php of your current theme like this

array(
'id' => 'sidebar_active',
'label' => $txt['sidebar_active'],
'default' => true,
),
array(
'id' => 'sidebar_title', //ID OF ARRAY
'label' => $txt['sidebar_title'], //LANGUAGE VARIABLE
'type' => 'text', //TYPE OF SETTING
),


first is a checkbox,and the second array is a textbox,and later you must call it,example my sidebar is in index.template.php



if(!empty($settings['sidebar_active'])){
echo'<div id="zsidebar">
<div id="headerside">
    <center><h3>'.$settings['sidebar_title'].'</h3></center>
</div>
        </center>

ETC.....



if(!empty($settings['sidebar_active']))

This code evaluate the condition of the setting
Remember set language variables
Last released modifications: AdSense Mod|Font AweaZome BBC code

Pipke

hmm, where does smf store these settings then in the database, also i dont see any security as session checking?
"If something is wrong, fix it if you can. But train yourself not to worry: Worry never fixes anything."

Click here to view my mods for SMF

Hey 👋 Did i helped... you like what i do. You can now buy me a coffee! ☕

Kindred

it stores them in the themes table

and all of the security is handled within the SMF functions
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Pipke

"If something is wrong, fix it if you can. But train yourself not to worry: Worry never fixes anything."

Click here to view my mods for SMF

Hey 👋 Did i helped... you like what i do. You can now buy me a coffee! ☕

Pipke

This seems to work but not entirely what i was looking for. Ive found some other way to achive what i wanted.
"If something is wrong, fix it if you can. But train yourself not to worry: Worry never fixes anything."

Click here to view my mods for SMF

Hey 👋 Did i helped... you like what i do. You can now buy me a coffee! ☕

Vehement Works

Last released modifications: AdSense Mod|Font AweaZome BBC code

Advertisement: