ECB2 (Enhanced Content Blocks) Support Page

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
User avatar
chrisbt
Dev Team Member
Dev Team Member
Posts: 179
Joined: Sun Sep 05, 2010 6:11 am
Location: Sheffield, UK

ECB2 (Enhanced Content Blocks) Support Page

Post by chrisbt »

Hi All, as the developer of ECB2, please feel to ask any support questions here.

If you have any questions or feedback please add them here, or ask on the Slack CMS Made Simple channel (I'm normally around).
You can add Feature Requests or Bug Reports here: http://dev.cmsmadesimple.org/projects/ecb2.
User avatar
chrisbt
Dev Team Member
Dev Team Member
Posts: 179
Joined: Sun Sep 05, 2010 6:11 am
Location: Sheffield, UK

Re: ECB2 (Enhanced Content Blocks) Support Page

Post by chrisbt »

Roadmap for ECB2
The development of ECB2 has been a long time in planning an quite a while in actual development. It has been kindly sponsored by the following, who have hastened and guided it's development:
Completed
  • complete rewrite of ECB2 structure to allow for growth and maintenance
  • simplify and combine multiple field types for easier maintenance and use field & parameter aliases to provide full backwards compatibility
  • Gallery field added - partially complete. Drag & drop uploading, multiple images, thumbnail generation.
  • Group field added - a group of one or more sub fields can be added, sorted or deleted. Can display in table or block layout.

Roadmap
  • Gallery improvements - adding sub-fields, reordering images, add images from FileManager directory, add demo gallery
  • Show/Hide option for Gallery, Group, repeater fields - under consideration
  • Admin page to define content blocks - optionally define content blocks once in an admin page then add to multiple templates with a simplified tag
  • add Sections field type - optionally add a new section that can be any one of a number different field types
  • add in help_text option for all fields, like {cms_help}
  • datalist option for inputs - suggest but not required values
  • enable ECB2 fields to be used in other modules - provide consistent UI across pages & modules

While there are significant changes planned for this module, I fundamentally believe in maintaining backwards compatibility. While I can't always guarantee this I will try my utmost to achieve it. I use CMSMS, the ECB2 module and many others to build websites on a daily basis. I definitely do not want compatibility issues for myself or my clients when upgrading, or for you & your clients :)
User avatar
PinkElephant
Forum Members
Forum Members
Posts: 169
Joined: Fri Feb 06, 2009 2:08 pm

Re: ECB2 (Enhanced Content Blocks) Support Page

Post by PinkElephant »

Firstly, thanks for a brilliant module -- it's the best thing since sliced bread and then some. It makes a huge difference to the admin interface :)

I'm having trouble grabbing data and would appreciate guidance...

Page global-content-blocks contains an ecb2 group block, video, comprising 2 dropdowns and 2 textinputs.

I can access the data from another page template with;

Code: Select all

{$video_embeds="{page_attr key=video page='global-content-blocks'}" scope=global}
... at this point {dump item=$video_embeds} shows;

Code: Select all

Dump of: $video_embeds (Object)
Object Name: stdClass
Parent: 
Properties: 
- modules: Array (1) {$video_embeds->modules}
... and {dump item='$video_embeds'};

Code: Select all

Dump of: ${"sub_fields":[{"source":"vimeo","id":74886136,"ratio":"4x3","desc":"Recording Hedda"},{"source":"vimeo","id":722923234,"ratio":"4x3","desc":"The Happy Prince \/ Den lykkelige prins"},{"source":"vimeo","id":703728617,"ratio":"4x3","desc":"A Promemoria \/ Et promemoria"}]} (Object)
Object Name: stdClass
Parent: 
Properties: 
- modules: Array (1) {${"sub_fields":[{"source":"vimeo","id":74886136,"ratio":"4x3","desc":"Recording Hedda"},{"source":"vimeo","id":722923234,"ratio":"4x3","desc":"The Happy Prince \/ Den lykkelige prins"},{"source":"vimeo","id":703728617,"ratio":"4x3","desc":"A Promemoria \/ Et promemoria"}]}->modules}
... but attempts to iterate the object result in nothing. I thought I'd be able to treat the data as an array with the usual;

Code: Select all

{foreach $video_embeds->sub_fields as $sub_field}
    {foreach $sub_field as $name => $value}
        {$name}: {$value}<br>
    {/foreach}
    {* or direct access *}
        Source : {$sub_field->source}
{/foreach}
... but nothing doing. Any pointers appreciated...
User avatar
chrisbt
Dev Team Member
Dev Team Member
Posts: 179
Joined: Sun Sep 05, 2010 6:11 am
Location: Sheffield, UK

Re: ECB2 (Enhanced Content Blocks) Support Page

Post by chrisbt »

Hi, thanks for your feedback. Great to hear you are finding it useful. A few extra features to come yet. :)

I haven't tested this but I am fairly certain that you need to change the method you use to access the content block. Use assign instead. Whenever json data is being retrieved it will be blank unless you use assign. A smarty thing I believe.

Try replacing this:
{$video_embeds="{page_attr key=video page='global-content-blocks'}" scope=global}

With this:
{page_attr key=video page='global-content-blocks' assign=video_embeds}{$video_embeds=$video_embeds scope=global}

Please let me know how you get on.

Chris
User avatar
PinkElephant
Forum Members
Forum Members
Posts: 169
Joined: Fri Feb 06, 2009 2:08 pm

Re: ECB2 (Enhanced Content Blocks) Support Page

Post by PinkElephant »

Hi Chris

Thanks for posting.
chrisbt wrote: Wed Mar 29, 2023 9:59 pm this:
{page_attr key=video page='global-content-blocks' assign=video_embeds}{$video_embeds=$video_embeds scope=global}
No difference and {dump item='$video_embeds->sub_fields'} shows String...

Code: Select all

Dump of: $video_embeds->sub_fields (String)
{"sub_fields":[{"source":"vimeo","id":74886136,"ratio":"4x3","desc":"Recording Hedda"},
Unless I'm doing something daft maybe it's s a limitation of {page_attr}.

I'm on the road for a few days but will revisit early next week.

On a separate note, the ecb2 gallery field is awesome - light, powerful and great UX - but a bit of a sanity check: when I try to add a second (standalone) instance, with a unique block name, uploading to instance 2 populates instance 1! The block names are unique and there's no obvious reason why it's happening. Presumably, it's not by design -- i.e., we can have multiple independent gallery fields in a template?

Thanks again... :)
User avatar
chrisbt
Dev Team Member
Dev Team Member
Posts: 179
Joined: Sun Sep 05, 2010 6:11 am
Location: Sheffield, UK

Re: ECB2 (Enhanced Content Blocks) Support Page

Post by chrisbt »

Ah OK. try a json_decode ...
{page_attr key=video page='global-content-blocks' assign=video_embeds}{$video_embeds=$video_embeds|json_decode scope=global}

I might add an option for ECB to retrieve a content block from another page in a future version.

I thought I'd fixed the issue with multiple gallery fields, populating only the first instance. Are you using the latest version? v2.2?
If so could you please post the code you are using and I'll retest.

Thanks

Chris
User avatar
PinkElephant
Forum Members
Forum Members
Posts: 169
Joined: Fri Feb 06, 2009 2:08 pm

Re: ECB2 (Enhanced Content Blocks) Support Page

Post by PinkElephant »

chrisbt wrote: Fri Mar 31, 2023 8:58 amtry a json_decode ...
[…]
version? v2.2?
I won’t have shell access to get at the templates for a few days but the decode sounds highly promising.

Apologies for the lack of version info.

Code: Select all

Cms Version: 2.2.16
Installed Modules:
* AdminSearch: 1.0.6
* CMSContentManager: 1.1.9
* CMSMSExt: 1.4.1
* CmsJobManager: 0.1.3
* DesignManager: 1.1.9
* ECB2: 2.2
* FileManager: 1.6.12
* FilePicker: 1.0.5
* Gallery: 2.4.3
* MicroTiny: 2.2.5
* ModuleManager: 2.1.8
* Navigator: 1.0.9
* News: 2.51.11
* Search: 1.53
* SmartImage: 1.1.0

Config Information:
* php_memory_limit:
* max_upload_size: 10000000
* url_rewriting: mod_rewrite
* page_extension:
* query_var: page
* auto_alias_content: true
* locale:
* set_names: true
* timezone: Europe/London
* permissive_smarty: false

Php Information:
* phpversion: 7.4.33
* md5_function: On (True)
* json_function: On (True)
* gd_version: 2
* tempnam_function: On (True)
* magic_quotes_runtime: Off (False)
* E_ALL: 22527
* E_STRICT: 0
* E_DEPRECATED: 0
* test_file_timedifference: No time difference found
* test_db_timedifference: No time difference found
* create_dir_and_file: 1
* memory_limit: 128M
* max_execution_time: 120
* register_globals: Off (False)
* output_buffering: 4096
* disable_functions: pcntl_alarm, pcntl_fork, pcntl_waitpid, pcntl_wait, pcntl_wifexited, pcntl_wifstopped, pcntl_wifsignaled, pcntl_wifcontinued, pcntl_wexitstatus, pcntl_wtermsig, pcntl_wstopsig, pcntl_signal, pcntl_signal_get_handler, pcntl_signal_dispatch, pcntl_get_last_error, pcntl_strerror, pcntl_sigprocmask, pcntl_sigwaitinfo, pcntl_sigtimedwait, pcntl_exec, pcntl_getpriority, pcntl_setpriority, pcntl_async_signals, pcntl_unshare,
* open_basedir:
* test_remote_url: Success
* file_uploads: On (True)
* post_max_size: 10M
* upload_max_filesize: 10M
* session_save_path: /srv/example.com/php_sessions/ (2775)
* session_use_cookies: On (True)
* xml_function: On (True)
* xmlreader_class: On (True)
* check_ini_set: On (True)
* curl: On

Performance Information:
* allow_browser_cache: On (True)
* browser_cache_expiry: 60
* php_opcache: On (True)
* smarty_cache: Off (False)
* smarty_compilecheck: Off (False)
* auto_clear_cache_age: On (True)
Server Information:
* Server Software: Apache
* Server Api: apache2handler
* Server Os: Linux 5.10.0-21-amd64 On x86_64
* Server Db Type: MySQL (mysqli)
* Server Db Version: 10.5.18
* Server Db Grants: Found a "GRANT ALL" statement that appears to be suitable

Permission Information:
* tmp: /srv/example.com/public/htdocs/2.0/tmp (2775)
* tmp_cache: /srv/example.com/public/cmsms_private/2.0/tmp/cache (2775)
* templates_c: /srv/example.com/public/cmsms_private/2.0/tmp/compiled_templates (2775)
* modules: /srv/example.com/public/htdocs/2.0/modules (2775)
* uploads: /srv/example.com/public/htdocs/2.0/uploads (2775)
* File Creation Mask (umask): /srv/example.com/public/cmsms_private/2.0/tmp/cache (2775)
* config_file: 0444
Thanks!
User avatar
PinkElephant
Forum Members
Forum Members
Posts: 169
Joined: Fri Feb 06, 2009 2:08 pm

Re: ECB2 (Enhanced Content Blocks) Support Page

Post by PinkElephant »

Hi Chris

The json_decode modifier fully fixed the page_attr group data -- thanks!
chrisbt wrote: Fri Mar 31, 2023 8:58 ammultiple gallery fields, populating only the first instance [...] could you please post the code
The two gallery fields are defined with;

Code: Select all

{content_module module=ECB2 field=admin_fieldset_start block=g01_afs label='&nbsp;'}
{content_module module=ECB2 field=gallery block=g01 label='Header images (Carousel)' assign=g01
    sub1_field=textinput sub1_name=title    sub1_label='Title'      sub1_size=100
    sub2_field=textinput sub2_name=subtitle sub2_label='Sub-title'  sub2_size=100
    sub3_field=textinput sub3_name=alt_text sub3_label="'Alt text'" sub3_size=200
    sub3_description='Short description of the image - this is used by screen readers to assist the visually impaired'
}
{$g01=$g01 scope=global}
{content_module module=ECB2 field=admin_text block=g01_at label='&nbsp;'
    text='These images will be set at a fixed height and can span the entire screen width. The Carousel 
          is best suited to images with a landscape orientation. This is because the aspect ratio is 
          always preserved and portrait images are more likely to need cropping to fit the image into 
          the fixed height area.'
}
{content_module module=ECB2 field=admin_fieldset_end block=g01_afe
    label='Upload images, drag the thumbnails to change the display order and use Edit to add
          captions and brief descriptions to assist the visually impaired.'
}
... and...

Code: Select all

{content_module module=ECB2 field=admin_fieldset_start block=g02_afs label='&nbsp;'}
{content_module module=ECB2 field=gallery block=g02 label='Content images (static)' assign=g02
    sub1_field=textinput sub1_name=title    sub1_label='Title'      sub1_size=100
    sub2_field=textinput sub2_name=subtitle sub2_label='Sub-title'  sub2_size=100
    sub3_field=textinput sub3_name=alt_text sub3_label="'Alt text'" sub3_size=200
    sub3_description='Short description of the image - this is used by screen readers to assist the visually impaired'
}
{$g02=$g02 scope=global}
{content_module module=ECB2 field=admin_text block=g02_at label='&nbsp;'
    text="These images will be shown with the preceding content. They will appear side-by-side 
          on medium to large screen displays and underneath on smaller devices. Don't forget the 
          Alt text!"
}
{content_module module=ECB2 field=admin_fieldset_end block=g02_afe
    label='Upload images, drag the thumbnails to change the display order and use Edit to add
          captions and brief descriptions to assist the visually impaired.'
}
... where $g02 populates $g01.

This barebones replacement is also enough to show the issue;

Code: Select all

{content_module module=ECB2 field=gallery block=g_test01 label='Test gallery 1' assign=g_test01}
{content_module module=ECB2 field=gallery block=g_test02 label='Test gallery 2' assign=g_test02}
Thanks again!
User avatar
chrisbt
Dev Team Member
Dev Team Member
Posts: 179
Joined: Sun Sep 05, 2010 6:11 am
Location: Sheffield, UK

Re: ECB2 (Enhanced Content Blocks) Support Page

Post by chrisbt »

Hi PinkElephant,

I've checked out the barebones example and it worked perfectly for me. I'm now trying to find how to replicate the error you are seeing.

Could you help with the following:
- What browser / device are you using?
- What are the files names of the images you are trying to upload?
- Are there any js console errors after you upload the images that drop into the wrong gallery.
- can you find the link to the file ... /ECB2/lib/js/ecb2_admin.js?v2.2 in the page source of the admin page?

Clutching at straws a bit to replicate the issue.

Thanks for any help you can provide.

Cheers

Chris
User avatar
PinkElephant
Forum Members
Forum Members
Posts: 169
Joined: Fri Feb 06, 2009 2:08 pm

Re: ECB2 (Enhanced Content Blocks) Support Page

Post by PinkElephant »

Hi Chris
chrisbt wrote: Wed Apr 05, 2023 8:58 am trying to find how to replicate the error
I'm running under Win10 Pro (22H2), only with Firefox 111.0.1 (64-bit) until your post. Switching to Chrome 112.0.5615.50 (Official Build 64bit) there's new behaviour where the upload target alternates between instances...

All additions have gone via the upload prompt (File Open dialog) rather than Drag & Drop.

On Chrome, starting with two empty instances:
  • On instance 1: Adding a single-file uploads & populates successfully. The File Open dialog instantly reappears (unseen behaviour under Firefox) and selecting a second file populates instance 2 with no further dialog. The pattern repeats when attempting to add a second file.
  • [Delete all images]
  • On instance 2: adding a single-file initially populates instance 1, using the (unexpected) follow-up dialog populates instance 2.
Moving back to Firefox, ecb2_admin.js?v2.2 only shows on line 90...

Code: Select all

<__script__ language="javascript" src="https://www.example.com/2.0/modules/ECB2/lib/js/ecb2_admin.js?v2.2"></__script>
The Console looks clean except for one Info message when the upload button is clicked...

Code: Select all

<input> picker was blocked due to lack of user activation.  ecb2_admin.js:45:18073
... prior to an upload...

Code: Select all

https://www.example.com/2.0/example-admin/moduleinterface.php?mact=ECB2,m1_,do_UploadFiles,0&__c=dca7dc74c821247ad0a 
(file names are normal digital camera fodder)

If you want admin access to a test installation, where you're free to go berserk ;), or if I can help in any other way, just let me know.

Thanks again!
User avatar
chrisbt
Dev Team Member
Dev Team Member
Posts: 179
Joined: Sun Sep 05, 2010 6:11 am
Location: Sheffield, UK

Re: ECB2 (Enhanced Content Blocks) Support Page

Post by chrisbt »

Thanks. Finally got there I believe. All the details helped loads. The problem was with the Upload Prompt - the upload prompt for each gallery was being added to both galleries. Hopefully is all sorted now. Please try the latest v2.2.1 release. :)
User avatar
PinkElephant
Forum Members
Forum Members
Posts: 169
Joined: Fri Feb 06, 2009 2:08 pm

Re: ECB2 (Enhanced Content Blocks) Support Page

Post by PinkElephant »

chrisbt wrote: Wed Apr 05, 2023 7:59 pmv2.2.1
Looks perfect! Great work and thanks for the quick fix. :)
WDJames
Forum Members
Forum Members
Posts: 64
Joined: Tue Feb 13, 2018 1:09 pm

Re: ECB2 (Enhanced Content Blocks) Support Page

Post by WDJames »

Hi Chris,

Thanks for the awesome module - its definitely changing the way we build within CMSMS.

Not sure if this is the correct way to go about asking for future features but are there any plans on adding a "File Upload" field? Being able to upload images using the "Gallery" field type is great and it would be awesome to have something similar as a stand alone file or within the "Group" field type. I guess I can just add sub_fields on the "Gallery" field but we also like the way the "Group" field is laid out.

Thanks again for the amazing module.

James
User avatar
chrisbt
Dev Team Member
Dev Team Member
Posts: 179
Joined: Sun Sep 05, 2010 6:11 am
Location: Sheffield, UK

Re: ECB2 (Enhanced Content Blocks) Support Page

Post by chrisbt »

Hi James,

Thanks for the feedback - very appreciated.

I'll put File Upload option on the to do list. I'm planning a bit more work on the module if I can fit it in in May, so hopefully will get to it then.

Happy for you to either use this post or to add a Bug Report http://dev.cmsmadesimple.org/bug/list/1366 or Feature Request http://dev.cmsmadesimple.org/feature_request/list/1366

Great to get some feedback and understand requirements that might just be a bit different to my own.

Cheers

Chris
User avatar
brambaud
New Member
New Member
Posts: 7
Joined: Mon Apr 18, 2011 8:38 am

Re: ECB2 (Enhanced Content Blocks) Support Page

Post by brambaud »

Hi Chris,

I just want to say a BIG thank you for this amazing mod.
With Lise2, this module adds new ways to manage content in an easy and awesome way.
Love it !

ps : having a file or an image picker as a sub-element of a group field will definitively be a killer feature :)

+++
Benoit
French CMSMS websites maker
Post Reply

Return to “Modules/Add-Ons”