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: 190
Joined: Sun Sep 05, 2010 6:11 am
Location: Sheffield, UK

Re: ECB2 (Enhanced Content Blocks) Support Page

Post by chrisbt »

Hi Benoit,
Thanks very much for your feedback. It is great and rewarding to get your feedback. I really don't have much of an idea how many people use ECB2 or what they think of it. So thanks :)
File / Image picker for groups will be great. It is in the plan was just a bit more involved than I realised to be able to push out with the last release. Hopefully soon.
Chris :)
webform
Power Poster
Power Poster
Posts: 489
Joined: Sat Nov 25, 2006 3:39 pm
Location: Copenhagen, Denmark

Re: ECB2 (Enhanced Content Blocks) Support Page

Post by webform »

I can test if an ECB" Group has data with

Code: Select all

{if !empty($test20->sub_fields)}{* test if any data exists *}
But if i have multiple Groups, how do i test if a groups subfields is not empty?

Edit: Doh! :-[
!empty() works just fine with multiple Groups. I've messed up my if/else statements.
User avatar
chrisbt
Dev Team Member
Dev Team Member
Posts: 190
Joined: Sun Sep 05, 2010 6:11 am
Location: Sheffield, UK

Re: ECB2 (Enhanced Content Blocks) Support Page

Post by chrisbt »

Hi,

For now you would have to test each individual sub_field so something like:
{foreach $test20->sub_fields as $sub_field}
{if !empty($sub_field->height) && !empty($sub_field->fruit) && !empty($sub_field->checkbox) && !empty($sub_field->radio)}
... then do some stuff ...
{/if}
{/foreach}

But I've been asked this a few times so I think I will add in a plugin to a future version to make this easier
webform
Power Poster
Power Poster
Posts: 489
Joined: Sat Nov 25, 2006 3:39 pm
Location: Copenhagen, Denmark

Re: ECB2 (Enhanced Content Blocks) Support Page

Post by webform »

Thanks!

I was not trying to do something that advanced, only to load different layout parts depending if a group has any rows.
And the default way works just fine. I've just made a mistake in my if statement.

Code: Select all

{if !empty($section01_rows->sub_fields)}
	{include file='cms_template:templatepart_section01'}
{/if}
{if !empty($section02_rows->sub_fields)}
	{include file='cms_template:templatepart_section02'}
{/if}
{if !empty($section03_rows->sub_fields)}
	{include file='cms_template:templatepart_section03'}
{/if}
{if !empty($section04_rows->sub_fields)}
	{include file='cms_template:templatepart_section04'}
{/if}
{if !empty($section05_rows->sub_fields)}
	{include file='cms_template:templatepart_section05'}
{/if}
{if !empty($section06_rows->sub_fields)}
	{include file='cms_template:templatepart_section06'}
{/if}
webform
Power Poster
Power Poster
Posts: 489
Joined: Sat Nov 25, 2006 3:39 pm
Location: Copenhagen, Denmark

Re: ECB2 (Enhanced Content Blocks) Support Page

Post by webform »

Hi Chris,

Am I mistaken, you can't use the Search module on content fields in ECB2 Groups?

However, I do get a search result on content in regular ECB2 content fields.
User avatar
chrisbt
Dev Team Member
Dev Team Member
Posts: 190
Joined: Sun Sep 05, 2010 6:11 am
Location: Sheffield, UK

Re: ECB2 (Enhanced Content Blocks) Support Page

Post by chrisbt »

Hi, Search should still work. The only difference with Groups is that the data is all in JSON format. So Search should still work. In the tests I have run it worked. What is the search term you are looking for?
webform
Power Poster
Power Poster
Posts: 489
Joined: Sat Nov 25, 2006 3:39 pm
Location: Copenhagen, Denmark

Re: ECB2 (Enhanced Content Blocks) Support Page

Post by webform »

Hmm! I'm not getting any result if i search for any words present in a group field.

I have a group set up like this in my template:

Code: Select all

{content_module module='ECB2' field='group' block='section01_rows' layout=block label='Rows' assign='section01_rows'
sub1_field=textinput sub1_name=title sub1_label='Title' sub1_size=50
sub2_field=editor sub2_name=content sub2_label='Content'
sub3_field=file_picker sub3_name=image sub3_label='Content Image' sub3_type=image
sub4_field=page_picker sub4_name=page sub4_label='Button Page Link' sub4_allow_all=true
sub5_field=textinput sub5_name=button_external sub5_label='Button External URL' sub5_size=50
sub6_field=textinput sub6_name=button_title sub6_label='Button Text' sub6_size=50
sub7_field=textinput sub7_name=button_class sub7_label='Button Class' sub7_size=50
sub8_field=textinput sub8_name=row_class sub8_label='Row Class' sub8_size=50}
I'm searching any word present in either the sub1_field (Textinput) or the sub2_field (Editor/textarea) but get "No results".
User avatar
chrisbt
Dev Team Member
Dev Team Member
Posts: 190
Joined: Sun Sep 05, 2010 6:11 am
Location: Sheffield, UK

Re: ECB2 (Enhanced Content Blocks) Support Page

Post by chrisbt »

I've just done some more tests and I agree I'm not finding search results for the content I added inside a group. I'll need to do some more digging to find out why and how to fix it. Thanks for highlighting this.
DPC
New Member
New Member
Posts: 2
Joined: Fri Apr 19, 2024 8:01 am
Location: Minden, GERMANY

Re: ECB2 (Enhanced Content Blocks) Support Page

Post by DPC »

Hi,

First of all, I would like to express my thanks for taking on this project: I admire your work very much. Thank you very much.

Now to my problem:
I have created a one-pager website. My approach is to have a parent page with several subordinate pages. The subordinate pages are used as content sections, so to speak. In the parent page, I use the following snippet to fetch the content from the subpages:

Code: Select all

Code: Select all

{* Catch the content from Children Sites *}
{$children=cgsimple::get_children('','')}
{if count($children)}
   {foreach from=$children item='child'}
   {page_attr key='content_en' page=$child.alias assign='content_from_childpage'}
   <div>{eval $content_from_childpage}</div>
   {/foreach}
{/if}
This works wonderfully with the standard content block. But now I want to use ECB2 to maintain the content. However, I do not get any content displayed. ECB2 should actually write to the content_en object. Can you give me a tip on how to proceed so that this combination works?

Installed module version : ECB2 - 2.4.2
CGSimpleSmarty : 2.2.1
CMS made simple Version: 2.2.16

Many thanks in advance
best regards
Daniel
DPC-iT solutions & webdesign
User avatar
chrisbt
Dev Team Member
Dev Team Member
Posts: 190
Joined: Sun Sep 05, 2010 6:11 am
Location: Sheffield, UK

Re: ECB2 (Enhanced Content Blocks) Support Page

Post by chrisbt »

Hi Daniel,

Thanks & glad you like the module. There are a couple of things that might help:

First you need to get ECB to store it's data in the default content block:
{content_module module=ECB2 field=some_field_type block=content_en ...}

Then depending on the field type used, the contents will either be a simple string, or in json format, e.g. for gallery or group types. In that case you simply need to decode the json data first:
{page_attr key='content_en' page=$child.alias assign='content_from_childpage'}
{$content_from_childpage=$content_from_childpage|json_decode}
<div>{$content_from_childpage|print_r}</div>{* content you want might be in an array of objects *}

Another gotcha can be if you use any modules that replace the default content block 'content_en' with their own output for the page. You can get around that by not using content_en (and hide that on another content manager tab - e.g. options) and then test if content_en is blank or not. You may not need to deal with such - so just ignore this paragraph :)
DPC
New Member
New Member
Posts: 2
Joined: Fri Apr 19, 2024 8:01 am
Location: Minden, GERMANY

Re: ECB2 (Enhanced Content Blocks) Support Page

Post by DPC »

Hi Chris,

First of all, thank you very much for your quick support. With your help, I have now managed to display the content of a text field. However, I worked with core templates for the subpages to structure the content and create the design.

Below is a small example code:

Code: Select all

{content_module module=ECB2 field=textinput block=content_en label='Small headline' size=50 max_length=50 assign=sub_headline}
{content_module module=ECB2 field=textinput block=content_en label='Headline' size=120 max_length=120 assign=headline}
{content_module module=ECB2 field=textinput block=content_en label='Introduction' size=200 max_length=200 repeater=1 assign=welcome_text}
{content_module module=ECB2 field=gallery block=content_en label='Gallery of workspaces' assign=gallery sub1_field=textinput sub1_name=title sub1_label='Title' sub2_field=editor sub2_name=description sub2_label='Description' assign=welcome_gallery}

<h1 class="text-center">{$sub_headline}</h1>
<h2 class="text-center">{$headline}</h2>
<p>{$welcome_text}</p>
I now have 2 problems: ::)
1.) The content is not written between the tags as specified in the template, but apparently, the module does not care about the template.
2) Since the content is redirected several times to the standard content block, I get the following error message when calling the page in the backend:
"Duplicate content block: content_en"

Can you please give me a tip here?
best regards
Daniel
DPC-iT solutions & webdesign
10010110
Translator
Translator
Posts: 224
Joined: Tue Jan 22, 2008 9:57 am

Re: ECB2 (Enhanced Content Blocks) Support Page

Post by 10010110 »

Chris, thanks for this useful module. If I had known about this thread I’d have posted my issue right here but alas, I’ve created a separate thread at viewtopic.php?t=84008. I’d be curious whether this is an actual bug or just an ID-10-T error.
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1715
Joined: Wed Feb 25, 2009 4:25 am
Location: Victoria, BC

Re: ECB2 (Enhanced Content Blocks) Support Page

Post by DIGI3 »

You must use a unique block identifier for each block, and content_en is reserved for the default {content} block. So change the block=content_en parameter to something different for each ECB2 tag.
DPC wrote: Fri Apr 19, 2024 1:20 pm
Below is a small example code:

Code: Select all

{content_module module=ECB2 field=textinput block=content_en label='Small headline' size=50 max_length=50 assign=sub_headline}
{content_module module=ECB2 field=textinput block=content_en label='Headline' size=120 max_length=120 assign=headline}
{content_module module=ECB2 field=textinput block=content_en label='Introduction' size=200 max_length=200 repeater=1 assign=welcome_text}
{content_module module=ECB2 field=gallery block=content_en label='Gallery of workspaces' assign=gallery sub1_field=textinput sub1_name=title sub1_label='Title' sub2_field=editor sub2_name=description sub2_label='Description' assign=welcome_gallery}

<h1 class="text-center">{$sub_headline}</h1>
<h2 class="text-center">{$headline}</h2>
<p>{$welcome_text}</p>
I now have 2 problems: ::)
1.) The content is not written between the tags as specified in the template, but apparently, the module does not care about the template.
2) Since the content is redirected several times to the standard content block, I get the following error message when calling the page in the backend:
"Duplicate content block: content_en"

Can you please give me a tip here?
Not getting the answer you need? CMSMS support options
musicscore
Power Poster
Power Poster
Posts: 472
Joined: Wed Jan 25, 2006 11:53 am
Location: Netherlands

Re: ECB2 (Enhanced Content Blocks) Support Page

Post by musicscore »

ECB2 not working (on new site)

I'm trying to enable ecb2 module to select background-images (later there wil be more selections) on a new website.
I userd ECB2 before without any problems be now, I cannot get is to work.

This is my simple page template (so far for testing):

Code: Select all

{strip}
	{process_pagedata}
{/strip}

<!doctype html>
<__html lang="{cms_get_language}">

<head>
	<title>{title} - {sitename}</title>
	{metadata}
	{cms_stylesheet}
</head>

</__body>
  {content_module module="ECB2" field="file_selector" block="background-image" dir="background-images" filetypes="jpg,gif,png" excludeprefix="thumb_" label='Selecteer achtergrond afbeelding' tab="Pagina Settings" assign='background-image'}

  {page_attr key='header-image' page=$node->alias assign='background_image'}


	<nav id="menu">
		{Navigator}
	</nav>

	<section id="content">
		<h1>{title}</h1>
		{content}
	</section>
<__body>

</__html>
The file selection field does not show up on the edit page page.
I compared (even copied) the code from a website where it is working but no luck.

What is wrong here.

The website where it is working is versie 2.2.15. The new site is 2.2.21. Can that be the cause ???
User avatar
chrisbt
Dev Team Member
Dev Team Member
Posts: 190
Joined: Sun Sep 05, 2010 6:11 am
Location: Sheffield, UK

Re: ECB2 (Enhanced Content Blocks) Support Page

Post by chrisbt »

Hi @musicscore,

I added in the Smarty call just as you had it and it worked, mostly, as expected. There was a new tab added 'Pagina Settings' with a select that was empty (as I didn't have a dir 'background-images'):

Code: Select all

{content_module module="ECB2" field="file_selector" block="background-image" dir="background-images" filetypes="jpg,gif,png" excludeprefix="thumb_" label='Selecteer achtergrond afbeelding' tab="Pagina Settings" assign='background-image'}
I changed it to the following, mainly changing the block & assign to 'backgroundImage' without the '-' so that it was a valid variable name. It then worked on both in the Content Manager and in the front-end.

Code: Select all

{content_module module=ECB2 field=file_selector block=backgroundImage dir=images filetypes='jpg,gif,png' excludeprefix='thumb_' label='Selecteer achtergrond afbeelding' tab='Pagina Settings' assign=backgroundImage}
<pre>$background-image:{$backgroundImage}</pre>
Post Reply

Return to “Modules/Add-Ons”