Default Values - enable access like a new section

3 posts by 2 authors in: Forums > CMS Builder
Last Post: September 19, 2012   (RSS)

Hey,

I want to make the "default values" of textfields etc of one particular schema to be available for editing by a normal user, so am thinking of making a custom page which displays / edits the default value for these fields, as I presume this data is stored somewhere in mySQL.

Before I do... anyone done this before, got any hints/tips, or a plugin? ;)

Cheers!

Re: [rjbathgate] Default Values - enable access like a new section

By Dave - September 7, 2012

Hi Rob,

The "default value" field supports PHP tags. So you can create a single record section called "defaults", with a field called "title_default" and then enter some code like this as the default:

<?php echo array_value(mysql_get('defaults', 1), 'title_default'); ?>

Or if you wanted, you could even let each user specify defaults and load it from their user account with:

<?php echo $CURRENT_USER['title_default'] . " by " . $CURRENT_USER['username']; ?>

Note: The above code uses some of our utility helper functions we include with the latest version of CMSB. You could write it out the long way as well if needed.

Hope that helps, let me know any questions.
Dave Edis - Senior Developer
interactivetools.com