Page 1 of 1
[Solved (underscores)] V 1.8 - Additional Content Blocks not showing in backend
Posted: Tue Jul 06, 2010 6:54 pm
by JohnnyB
Hi,
Using a Windows box with WAMP and a clean install of cmsms ver 1.8 does not let me added additional blocks of content. Placing the following tag next to the {content} in the NCleanBlue template: {content block="test_block" label="Test Block"}
When upgrading from 1.7.1 to 1.8 I lose the additional content blocks in the Admin but they show on the frontend. When going back to 1.7.1, the additional content blocks are there again. Strangely, I don't remember seeing this during beta testing.
----------------------------------------------
Cms Version: 1.8
Installed Modules:
* CMSMailer: 2.0
* FileManager: 1.0.2
* MenuManager: 1.6.5
* ModuleManager: 1.4
* News: 2.10.6
* nuSOAP: 1.0.1
* Printing: 1.1.0
* Search: 1.6.5
* ThemeManager: 1.1.1
* TinyMCE: 2.7.2
Config Information:
* php_memory_limit:
* process_whole_template: false
* output_compression: false
* max_upload_size: 10000000
* default_upload_permission: 664
* url_rewriting: mod_rewrite
* page_extension:
* query_var: page
* image_manipulation_prog: GD
* auto_alias_content: true
* locale:
* default_encoding: utf-8
* admin_encoding: utf-8
* set_names: true
Php Information:
* phpversion: 5.3.2
* md5_function: On (True)
* gd_version: 2
* tempnam_function: On (True)
* magic_quotes_runtime: Off (False)
* E_STRICT: 0
* E_DEPRECATED: 0
* memory_limit: 128M
* max_execution_time: 60
* output_buffering: 1
* safe_mode: Off (False)
* file_uploads: On (True)
* post_max_size: 10M
* upload_max_filesize: 10M
* session_save_path: c:/wamp/tmp (0777)
* session_use_cookies: On (True)
* xml_function: On (True)
Server Information:
* Server Api: apache2handler
* Server Db Type: MySQL (mysql)
* Server Db Version: 5.1.41
----------------------------------------------
Re: V 1.8 - Additional Content Blocks not showing in backend
Posted: Tue Jul 06, 2010 7:28 pm
by reneh
Yes I confirm this!
In previous versions underscore is allowed in content block=
In current 1.8 its not
but other separators like space are allowed....
So personally I call this a bug in 1.8
Re: V 1.8 - Additional Content Blocks not showing in backend
Posted: Tue Jul 06, 2010 7:52 pm
by NaN
There is another issue with the contenttype content.
When changing between contenttypes the additional blocks get lost.
I did the following:
Added in page template {content} and {content block="block"}.
Created a page and both blocks where there. Did no changes but just selected contenttype Sectionheader. Page reloads and i see the sectionheader form. Did no changes but selected contenttype content again. Page reloads and only the default block is shown.
Can anyone confirm that?
(have the same sys info like mww)
Re: V 1.8 - Additional Content Blocks not showing in backend
Posted: Tue Jul 06, 2010 8:07 pm
by JohnnyB
@NaN
I reproduced something similar. Content in the blocks gets lost. Here are my steps:
1) add {content block="block"}
2) Add New Content using content type = 'Content'
3) add page title, menu name, and text to content areas. Then Save page.
4) open page, change Content Type = "Section Header" - Do Not Save or Apply change
5) switch back to 'Content'
6) text in content blocks is gone
In previous versions, the text would remain intact
Re: V 1.8 - Additional Content Blocks not showing in backend
Posted: Tue Jul 06, 2010 8:13 pm
by NaN
mww wrote:
In previous versions underscore is allowed in content block=
In current 1.8 its not
but other separators like space are allowed....
So personally I call this a bug in 1.8
This is because of the regexp pattern in the file lib/classes/contenttypes/Content.inc.php.
When parsing the template for the content blocks it says in line 402:
That means no blocks that uses underscores in tagname, values or even param names will be found. I understand why this has been changed. Content blocks, content_image and content_module are handled seperately. First it checks for all content blocks (all those that does not start with {content_ but {content ). Then all that starts with {content_image... and then the ones with {content_module
But the used regexp pattern is just not right.
A negative lookahead should be used instead:
Code: Select all
$pattern = '/{content(?!_)([^}]*)}/';
Did not test it but it looks right for me.
Works fine

Re: V 1.8 - Additional Content Blocks not showing in backend
Posted: Wed Jul 07, 2010 2:23 pm
by RonnyK
mww wrote:
@NaN
I reproduced something similar. Content in the blocks gets lost. Here are my steps:
1) add {content block="block"}
2) Add New Content using content type = 'Content'
3) add page title, menu name, and text to content areas. Then Save page.
4) open page, change Content Type = "Section Header" - Do Not Save or Apply change
5) switch back to 'Content'
6) text in content blocks is gone
In previous versions, the text would remain intact
John,
could you explain in what version it was working, as I tried an earlier release, with 3 content-blocks, and on all 3, the content was still empty on rechanging.
Ronny
Re: V 1.8 - Additional Content Blocks not showing in backend
Posted: Wed Jul 07, 2010 3:14 pm
by JohnnyB
Hi Ronny,
I'm mistaken -sorry!

I went back to a 1.6 install and see that is normal behavior. Thanks!
Re: V 1.8 - Additional Content Blocks not showing in backend
Posted: Wed Jul 07, 2010 3:33 pm
by JohnnyB
@NaN
A negative lookahead should be used instead:
Code:
$pattern = '/{content(?!_)([^}]*)}/';
Works for me too - thanks!
Re: V 1.8 - Additional Content Blocks not showing in backend
Posted: Wed Jul 07, 2010 4:01 pm
by jeff1980
A negative lookahead should be used instead:
Code:
$pattern = '/{content(?!_)([^}]*)}/';
Tried this, too. Works fine

. Building my own "1.8.1" now with all these little snippets...
Jan
Re: V 1.8 - Additional Content Blocks not showing in backend
Posted: Wed Jul 07, 2010 4:45 pm
by owr_bgld
mww wrote:
4) open page, change Content Type = "Section Header" - Do Not Save or Apply change
5) switch back to 'Content'
6) text in content blocks is gone
This only is possible (text is not gone, if you make
7) go back to site list and enter site again, then it shows the content - because in 4) you didn't save

Re: V 1.8 - Additional Content Blocks not showing in backend
Posted: Wed Jul 07, 2010 5:20 pm
by NaN
But he saved it in step 3.
So in step 6 it should display this value instead of an empty block.
Re: V 1.8 - Additional Content Blocks not showing in backend
Posted: Wed Jul 07, 2010 6:09 pm
by owr_bgld
NaN wrote:
So in step 6 it should display this value instead of an empty block.
No - if you take an excisting page (or step 3), turn it to sectionheader and then back it shows an empty contentblock if you (want to) save after this you get the "content empty"-message.
and therefore I didn't mention the first three steps (saved content = existing page)
Re: V 1.8 - Additional Content Blocks not showing in backend
Posted: Wed Jul 07, 2010 6:32 pm
by NaN
owr_web wrote:
No - if you take an excisting page (or step 3), turn it to sectionheader and then back it shows an empty contentblock...
And that's the point.
Why does it show an empty content block now?
There should be some content.
There was one when i selected "edit page".
The content isn't empty. I did not change anything. So why does it show an empty block here?
(I just act like a noob here

)
And only because i changed to sectionheader (to see what this might be) and back WITHOUT touching the content it shouldn't be gone. It should show the content that was shown before i changed the contenttype. Showing an empty content block is just not that what is stored in the db and not that what i have entered.
I know it is not gone at all but going back to the list content page (click "cancel" or whatever) and then enter the site again is an additional step that can be avoided.
Just try AdvancedContent. There it works fine

But at the moment i'm not sure what exactly i changed in AdvancedContent to make it working. If i find it, i'll post it ...
EDIT:
Following changes in lib/classes/contenttype/Content.inc.php works or me:
Replace lines 484 and 562:
Code: Select all
$this->GetPropertyValue('extra1');
with this:
Code: Select all
$this->mProperties->Load($this->mId);
(Do we need to do this three times? The content props will be loaded in lines 484, 562 and 635. Loading it once before parsing the template for the content tags - e.g. after line 395 - should do it, shouldn't it?)
Replace lines 132 - 140:
Code: Select all
//pick up the template id before we do parameters
if (isset($params['template_id']))
{
if ($this->mTemplateId != $params['template_id'])
{
$this->_contentBlocksLoaded = false;
}
$this->mTemplateId = $params['template_id'];
}
with this:
Code: Select all
$this->_contentBlocksLoaded = false;
//pick up the template id before we do parameters
if (isset($params['template_id'])) {
$this->mTemplateId = $params['template_id'];
}
(We always need to set $this->_contentBlocksLoaded = false; in the function FillParams().
Not only if the template has been changed.
Because we also need to parse the template again for the content blocks if the contenttype has been changed - even if the template is the same since not all contenttypes have content blocks that will be submitted with the form when changing the contenttype.)
Re: V 1.8 - Additional Content Blocks not showing in backend
Posted: Thu Jul 08, 2010 4:30 pm
by JohnnyB
And only because i changed to sectionheader (to see what this might be) and back WITHOUT touching the content it shouldn't be gone. It should show the content that was shown before i changed the contenttype. Showing an empty content block is just not that what is stored in the db and not that what i have entered.
I know it is not gone at all but going back to the list content page (click "cancel" or whatever) and then enter the site again is an additional step that can be avoided.
I agree with this because although we know that the content is not gone until a save is performed, it can cause confusion to an end user.