Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 5    Views: 8914

nadthevlad
Code is Art
Profile
Posts: 1025
Reg: Jun 07, 2012
Denver
21,850
01/15/13 10:21 AM (13 years ago)

making json data persistent in index.php for plugin

I am having some trouble with keeping my json data persistent in the control panel. This is for a custom plugin. When I enter the text into the field and hit 'save' it saves the JSON data to the BT_config just fine. If I navigate away from plugins index.php, then come back to it, the fields are blank (which they should be). Then I enter a new value for only one of the fields and hit 'save', the new value gets saved to the BT_config file just fine, but all of the other fields get overwritten and erased. This makes it so that anytime I want to change one input field, I have to fill in them all with the same data again. Is there any way to make this so that the field data is persistent? Is this normal behavior for a custom plugin? http://dl.dropbox.com/u/2452503/index.php
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
01/15/13 10:51 AM (13 years ago)
Hey! Is this for a particular plugin, or is it happening in general with all plugins. It's certainly not the way it should happen, as far as I know. Mark
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
01/15/13 10:56 AM (13 years ago)
I think I understand what you're saying. Try to follow along... 1) You load index.php for your custom plugin (your attached image looks like it's based on the quiz plugin)... 2) The HTML for each input element needs a "value" This is the value that displays when you load the page. Look at all the other plugins, each input field shows the value from the screens existing (saved previously) JSON variables. It does this by echo 'ing the value it find in the screen JSON like... <input type="text" name="json_navBarTitleText" id="json_navBarTitleText" value="<?php echo fnFormOutput(fnGetJsonProperyValue("navBarTitleText", $jsonVars));?>"> 3) In your custom HTML fields, use that same method to echo the value just like that. That is doing it for a property called "navBarTitleText" but your input fields / property names will be different. Hope this helps.
 
nadthevlad
Code is Art
Profile
Posts: 1025
Reg: Jun 07, 2012
Denver
21,850
like
01/15/13 11:47 AM (13 years ago)
I see. I am missing the function call for the json getter:) Will give it a shot. Thanks.
 
nadthevlad
Code is Art
Profile
Posts: 1025
Reg: Jun 07, 2012
Denver
21,850
like
01/15/13 12:00 PM (13 years ago)
.dupe
 
nadthevlad
Code is Art
Profile
Posts: 1025
Reg: Jun 07, 2012
Denver
21,850
like
01/15/13 04:08 PM (13 years ago)
That worked. Thanks! spelling-> *property
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.