DragonPrime - LoGD Resource Community
Welcome Guest
  • Good afternoon, Guest.
    Please log in, or register.
  • May 18, 2013, 12:12:56 PM
Home Forums News Links Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
IRC Channels
Search

Pages: [1]   Go Down
  Print  
Author Topic: Database Controlled Settings and Prefs  (Read 318 times)
0 Members and 1 Guest are viewing this topic.
JollyGG
Mod God
*****
Offline Offline

Posts: 545


Jolly Good!


View Profile WWW
« on: January 08, 2012, 08:39:10 PM »

Didn't know how to word the Subject, but I gave it my best.

What I'm looking to do is have a database of things, each row being a different thing. Now I'm writing an editor into the module, so here is my problem. Is it possible to have automatically adding/removing prefs and settings that stay in line with the database?

For example. I add a new thing via the editor. It adds to the database. Then it also adds a new pref and setting for each new thing added to the database. And of course, when deleted from the editor, it removes the corresponding setting and pref.

Is that possible?
Logged

Owner of: Hogwarts Now
Supporter of: LotGD4Adults2, The Complex, and Dragons of Myth
Released Modules: Here
ArthuruhtrA
Mod God
*****
Offline Offline

Posts: 553


chown -R us ./base


View Profile WWW
« Reply #1 on: January 08, 2012, 08:56:06 PM »

I suppose you could do something like with the $session array...
The array gets created by looping through the columns of the accounts table, meaning every row that gets added makes a new cell in the array. At the end of page construction it saves any modification of this array back to the table.
So you could use that idea, assuming I understood your question correctly.
Logged

Dragons of MythMy Modules | Tynastera!
BOWTIES ARE COOL
JollyGG
Mod God
*****
Offline Offline

Posts: 545


Jolly Good!


View Profile WWW
« Reply #2 on: January 08, 2012, 09:10:55 PM »

* JollyGG waits to see if Marc has one of his famous solutions for this :3

And I'm not sure Arthur, lol
Logged

Owner of: Hogwarts Now
Supporter of: LotGD4Adults2, The Complex, and Dragons of Myth
Released Modules: Here
Anharat
Captain of the Guard
***
Offline Offline

Posts: 191


View Profile WWW
« Reply #3 on: January 09, 2012, 12:57:43 AM »

If I get you right with what ye want, ye could try one setting or two static settings. Like "additionalsettings" and "additionalprefs" or something. Just use them as "viewonly" for a serialized array.

I did never try this but it should work. Then you get those modulesettings and create the $info array with the readings of those settings, then they should be shown if ye check the modules settings/prefs via the module manager/user editor.

In your editor you just alter those arrays stored in your static (allways existing) settings. On delete ye might use a sql statement to delete the database entries manualy, otherwise they will probaly be keept till the module is deinstalled.
Logged

In a World of Compromise, we don't!
Afkamm
Mod God
*****
Offline Offline

Posts: 1563

MarcTheSlayer


View Profile WWW
« Reply #4 on: January 09, 2012, 05:04:34 AM »

So you want these prefs/settings to be added to the module that also has the editor (not that it would matter much)?

The alt currency module springs to mind. Does something more or less exactly. Use the editor to create currencies and then the getmoduleinfo() function has sql query code to grab the data from the table and create the prefs code which then gets added to the $info array.

Easily do the same with the settings.

:-)
Logged

JollyGG
Mod God
*****
Offline Offline

Posts: 545


Jolly Good!


View Profile WWW
« Reply #5 on: January 09, 2012, 05:08:13 PM »

Once again Marc..lol...I completely missed that. I indeed looked in the Altcurrency module as I liked that editor and wanted to see if I could make on like it. Thanks! I'll see what I can do from there :3
Logged

Owner of: Hogwarts Now
Supporter of: LotGD4Adults2, The Complex, and Dragons of Myth
Released Modules: Here
Pages: [1]   Go Up
  Print  
 
Jump to:  


*
DragonPrime Notices
Please take the time to read the FAQ and browse the DragonPedia

Support Us
$100 raised this year
Your help is greatly appreciated!
Who's Online
26 Guests, 0 Users
DragonPrime LoGD
Recent Topics
Home Forums News Links Downloads Login Register Advanced Search