Welcome, Guest. Please Login or Register.
May 02, 2025, 12:11:32 PM
Home Help Search Log in Register
News: SMF is the next generation in forum software, almost completely re-written from the ground up, make sure you don't fall for cheap imitations that suffer from feature bloat!

YaBB SE Community  |  Development  |  Mod Ideas and Creation  |  Mod Variables and ModSettings.php « previous next »
Pages: [1] Reply Ignore Print
Author Topic: Mod Variables and ModSettings.php  (Read 448 times)
Myiasis
Full Member
***
Posts: 178


I'm a llama!

Mod Variables and ModSettings.php
« on: April 29, 2002, 12:51:52 AM »
Reply with quote

This isn't really about a mod, but the interface for the variables a mod can use. I was thinking it would be nice to not have to modify ModSettings.php if I want some user variables in a mod. It works, but it's one more file to edit.

The information displayed in the ModSettings.php file could easily be automated to not need any user editing. If the 'settings' table were modified to include a few new columns for identifying which variables belong to which mods -- either a number controll maybe through you guys, mods would request an ID, or even a character field would work.

With some sort of mod identifier in the table the ModSettings.php could easily just pull all of the rows out of the table and create the same format we already see displayed by hand. Separating each mod's variables with the HR's like it has now. Mod writers would never have to worry about adding the references to ModSettings.php and it's one less file to have to keep up to date when new releases come out.

Proposed changes to 'settings' table:
variable -- already exists, no changes needed.
value -- already exists, no changes needed.

mod_id -- integer, having IDs assigned through this site, or text if that easier, leaving it up to the mod designers to choose a unique string to represent their mod.

visible -- just an idea for a bitfield to determine whether the variable should show up in ModSettings.php

prompt -- Text to display to the user in ModSettings.php.

type -- Type of form element to use to edit the variable (check box, list, edit field, drop down). For this maybe a 'known value' list of number representing the types (0=checkbox,1=edit,2=member group selection, etc...).

selections - text field - a way to represent fixed values for combo boxes and lists "option=value,option=value".

Would probably need a misc field or two to control the input. Like max_len for an text type input.

Mod designers have to insert their variables anyway. Add a little more data to the insert and you don't have to ever touch the ModSettings.php.

Insert Into xxx_settings (
   variable,
   value,
   mod_id,
   visible,
   prompt,
   type,
   selections)
Values (
   pollMode,
   0,
   12345, -- or 'Polls' if you prefer
   1, -- or suppose could be done as a 'Y/N'
   'Poll Mod Mode',
   4, -- assuming 4 is a combo box.
   '0=Disable Polls,1=Enable Polls,2=Show Polls as Topics')

The table now has enough data to represent the variable without requiring the mod designer to specifically go add the code to ModSettings.php.

If the designer ever wants to change anything about the variable, only the table needs to be modified: to show/hide it, change the prompt, remove it completely, add new, etc...

Anyway, just some ideas I had about it. If anybody actually likes this idea and the YaBB coders like it, I could maybe even be talked into doing it. I haven't worked out any details, I'm just typing the ideas out as I write this, but overall the idea should work and make life a little easiers on mod designers.

I hope this hasn't been brought up before -- I did poke around a little and didn't see anything mentioned about making it a data driven system for mod vars.

Aaron
Logged
Pages: [1] Reply Ignore Print 
YaBB SE Community  |  Development  |  Mod Ideas and Creation  |  Mod Variables and ModSettings.php « previous - next »
 


Powered by MySQL Powered by PHP YaBB SE Community | Powered by YaBB SE
© 2001-2003, YaBB SE Dev Team. All Rights Reserved.
SMF 2.1.4 © 2023, Simple Machines
Valid XHTML 1.0! Valid CSS

Page created in 0.011 seconds with 21 queries.