[Solved (underscores)] V 1.8 - Additional Content Blocks not showing in backend

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
JohnnyB
Dev Team Member
Dev Team Member
Posts: 731
Joined: Tue Nov 21, 2006 5:05 pm

[Solved (underscores)] V 1.8 - Additional Content Blocks not showing in backend

Post 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


----------------------------------------------
Last edited by JohnnyB on Thu Jul 08, 2010 4:32 pm, edited 1 time in total.
"The art of life lies in a constant readjustment to our surroundings." -Okakura Kakuzo

--
LinkedIn profile
--
I only speak/write in English so I may not translate well on International posts.
--
reneh
Dev Team Member
Dev Team Member
Posts: 446
Joined: Tue Nov 28, 2006 8:39 pm

Re: V 1.8 - Additional Content Blocks not showing in backend

Post 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
ReneH 8-)
A search will save you hours waiting for an answer! Image
NaN

Re: V 1.8 - Additional Content Blocks not showing in backend

Post 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)
Last edited by NaN on Tue Jul 06, 2010 7:54 pm, edited 1 time in total.
JohnnyB
Dev Team Member
Dev Team Member
Posts: 731
Joined: Tue Nov 21, 2006 5:05 pm

Re: V 1.8 - Additional Content Blocks not showing in backend

Post 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
"The art of life lies in a constant readjustment to our surroundings." -Okakura Kakuzo

--
LinkedIn profile
--
I only speak/write in English so I may not translate well on International posts.
--
NaN

Re: V 1.8 - Additional Content Blocks not showing in backend

Post 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:

Code: Select all

$pattern = '/{content([^_}]*)}/';
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 :)
Last edited by NaN on Tue Jul 06, 2010 8:23 pm, edited 1 time in total.
RonnyK
Support Guru
Support Guru
Posts: 4962
Joined: Wed Oct 25, 2006 8:29 pm

Re: V 1.8 - Additional Content Blocks not showing in backend

Post 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
JohnnyB
Dev Team Member
Dev Team Member
Posts: 731
Joined: Tue Nov 21, 2006 5:05 pm

Re: V 1.8 - Additional Content Blocks not showing in backend

Post by JohnnyB »

Hi Ronny,

I'm mistaken -sorry! :)  I went back to a 1.6 install and see that is normal behavior.  Thanks!
"The art of life lies in a constant readjustment to our surroundings." -Okakura Kakuzo

--
LinkedIn profile
--
I only speak/write in English so I may not translate well on International posts.
--
JohnnyB
Dev Team Member
Dev Team Member
Posts: 731
Joined: Tue Nov 21, 2006 5:05 pm

Re: V 1.8 - Additional Content Blocks not showing in backend

Post by JohnnyB »

@NaN
A negative lookahead should be used instead:
Code:
$pattern = '/{content(?!_)([^}]*)}/';
Works for me too - thanks!
"The art of life lies in a constant readjustment to our surroundings." -Okakura Kakuzo

--
LinkedIn profile
--
I only speak/write in English so I may not translate well on International posts.
--
jeff1980
Forum Members
Forum Members
Posts: 210
Joined: Mon Apr 30, 2007 1:46 pm

Re: V 1.8 - Additional Content Blocks not showing in backend

Post 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
owr_bgld

Re: V 1.8 - Additional Content Blocks not showing in backend

Post 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 ;D
NaN

Re: V 1.8 - Additional Content Blocks not showing in backend

Post by NaN »

But he saved it in step 3.
So in step 6 it should display this value instead of an empty block.
owr_bgld

Re: V 1.8 - Additional Content Blocks not showing in backend

Post 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)
NaN

Re: V 1.8 - Additional Content Blocks not showing in backend

Post 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.)
Last edited by NaN on Wed Jul 07, 2010 9:50 pm, edited 1 time in total.
JohnnyB
Dev Team Member
Dev Team Member
Posts: 731
Joined: Tue Nov 21, 2006 5:05 pm

Re: V 1.8 - Additional Content Blocks not showing in backend

Post 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.
"The art of life lies in a constant readjustment to our surroundings." -Okakura Kakuzo

--
LinkedIn profile
--
I only speak/write in English so I may not translate well on International posts.
--
Post Reply

Return to “CMSMS Core”