Different Editor Pages for Different Users

37 posts by 12 authors in: Forums > CMS Builder
Last Post: September 22, 2011   (RSS)

Hi Chris.

I'm not sure what to do here.

I have a section:Home Slider
Within it, I have a list field: type. The options in "type" are image|code|iframe.

The idea is that I have a jquery slider on the homepage, and the editor can populate each slide with either an image, some code (like embed code from youtube), or a URL that is inserted via an iframe.

How do I go about displaying the appropriate input fields depending on the "type" selected?
Cheers,

Tim (toledoh.com.au)

Re: [Toledoh] Different Editor Pages for Different Users

By Chris - December 13, 2010

Hi Tim,

You'll want to use the Show/Hide Dependant Fields Plugin. Try this code:

// For each section and list field, copy this block
// Fields will start hidden if they appear in any "fields to show" list
$GLOBALS['SHOWHIDE_DEPENDANT_FIELDS_CONFIG']['home_slider']['type'] = array(
// list option => fields to show
'' => array(), // show these fields when the topmost '<select>' option is selected
'image' => array('image_field_name'),
'code' => array('code_field_name'),
'url' => array('url_field_name'),
);


This code assumes that your "type" field's list options are 'image', 'code', and 'url'. You'll need to change the names of the fields above in red to reflect the fields you want to show.

Does this help? Please let me know if you have any questions.
All the best,
Chris
Hi Chris,

I couldn't get it to work. I've set up a test thinking that maybe I had something interfering....

I have a section "test"
I have a list field "select" with options "simple" and "complex"

Within the plugin, I have;
// For each section and list field, copy this block
// Fields will start hidden if they appear in any "fields to show" list
$GLOBALS['SHOWHIDE_DEPENDANT_FIELDS_CONFIG']['test']['select'] = array(
// list option => fields to show
'' => array(), // show these fields when the topmost '<select>' option is selected
'simple' => array('simple1,simple2'),
'complex' => array('complex1,complex2'),
);


I've attached a few screen grabs and code...
Cheers,

Tim (toledoh.com.au)

By aev - December 14, 2010

Hi Chris,

I can't get this to work:

// For each section and list field, copy this block
// Fields will start hidden if they appear in any "fields to show" list
$GLOBALS['SHOWHIDE_DEPENDANT_FIELDS_CONFIG']['nav1']['template'] = array(
// list option => fields to show
'' => array(), // show these fields when the topmost '<select>' option is selected
'standard' => array('content','content_image'),
'firstsub' => array('content','content_image'),
'list' => array('content','content_image','summary'),
);


I have a list field called 'template' inside the a CategorySection called 'nav1'.

Any suggestions?

-aev-

By Chris - December 14, 2010

Hi Tim,

You'll need to add some quotes around those commas:

'simple' => array('simple1','simple2'),
'complex' => array('complex1','complex2'),


If that doesn't fix things, could you please fill out a Second Level Support Request too? :)
All the best,
Chris
support request sent...
Cheers,

Tim (toledoh.com.au)

Re: [Toledoh] Different Editor Pages for Different Users

By Chris - December 14, 2010

Hi Tim,

Thanks! I fixed a bug and have uploaded a new version (v0.02). I've already updated yours, Tim, and your test section is working for me. :)

@aev: Please download the patched plugin and see if that fixes your problem.
All the best,
Chris

By aev - December 15, 2010

Hi Chris,

your updated plug-in worked great!

What we would like next is this to be a built-in feature, with configuration done inside the CMSB Admin > Section Editor page.

Thanks for the plugin!

-aev-

Re: [aev] Different Editor Pages for Different Users

Brilliant - thanks Chris!
Cheers,

Tim (toledoh.com.au)