Page 1 of 1

[solved] error when adding page with several content fields

Posted: Wed May 26, 2010 9:48 am
by crosmuller
Hi,

I am using CMSMS 1.7.1

I created a template with 12 content fields, when a content field is empty it is not supposed to show up on the site. When I want to save a new pagewith this template I get the error  "geen inhoud toegevoegd"  (no content added), when I pick another "normal" template I can add the page, change the template to the 12 content field one and edit it and then there's no problem. So I can work around it but I would like a better solution for my users. Here's my template:

Code: Select all

{process_pagedata}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<__html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
{* Change lang="en" to the language of your site *}

<head>

<title>{sitename} - {title}</title>
{* The sitename is changed in Site Admin/Global settings. {title} is the name of each page *}

{metadata}
{* Don't remove this! Metadata is entered in Site Admin/Global settings. *}

{stylesheet}
{* This is how all the stylesheets attached to this template are linked to *}


{literal}
<__script__ type="text/JavaScript">
<!--
//pass min and max -measured against window width
function P7_MinMaxW(a,b){
	var nw="auto",w=document.documentElement.clientWidth;
	if(w>=b){nw=b+"px";}if(w<=a){nw=a+"px";}return nw;
}
//-->
</__script>
<!--[if lte IE 6]>
<style type="text/css">
#pagewrapper {width:expression(P7_MinMaxW(720,950));}
#container {height: 1%;}
</style>
<![endif]-->
{/literal}
{* The min and max page width for Internet Explorer is set here. For other browsers it's in the stylesheet "Layout: Top menu + 2 columns" *}


<!--[if IE]>
<__script__ type="text/javascript" src="modules/MenuManager/CSSMenu.js"></__script>
<![endif]-->
{* The above JavaScript is required for CSSMenu to work in IE *}
</head>

</__body>
<div class="main">

     {global_content name='landco header'}

<div class="menubalk">
<div class="menucontainer">
{menu template='cssmenu.tpl' excludeprefix="thema,landartpage,landartthema,histmoestuinenpage,histmoestuinenthema"}
</div>
</div>



  <div class="middle">
       <div class="column1">
{global_content name='landco subtitel'}
{global_content name='landco adressen'}
<div id="themamenu">
{menu  template="minimal_menu.tpl" includeprefix="landcothema"}
</div>
<div id=search>
{search searchtext="Type hier uw zoekterm"  resultpage="zoekresultaten"}
</div>
  {* Start News *}
      <div id="news">
            {news number='1' detailpage='news' lang="nl_NL"}
      </div>
      {* End News *}
     </div>

<div class="column2">
    {content block='blok2a' assign='blok2a'}{if !empty($blok2a)}<div class="blok">{$blok2a}</div>{/if}
    {content block='blok2b' assign='blok2b'}{if !empty($blok2b)}<div class="blok">{$blok2b}</div>{/if}
{content block='blok2c' assign='blok2c'}{if !empty($blok2c)}<div class="blok">{$blok2c}</div>{/if}
{content block='blok2d' assign='blok2d'}{if !empty($blok2d)}<div class="blok">{$blok2d}</div>{/if}
{content block='blok2e' assign='blok2e'}{if !empty($blok2e)}<div class="blok">{$blok2e}</div>{/if}
</div>

<div class="column3">
    {content block='blok3a' assign='blok3a'}{if !empty($blok3a)}<div class="blok">{$blok3a}</div>{/if}
    {content block='blok3b' assign='blok3b'}{if !empty($blok3b)}<div class="blok">{$blok3b}</div>{/if}
{content block='blok3c' assign='blok3c'}{if !empty($blok3c)}<div class="blok">{$blok3c}</div>{/if}
{content block='blok3d' assign='blok3d'}{if !empty($blok3d)}<div class="blok">{$blok3d}</div>{/if}
{content block='blok3e' assign='blok3e'}{if !empty($blok3e)}<div class="blok">{$blok3e}</div>{/if}
</div>

<div class="column4">
    {content block='blok4a' assign='blok4a'}{if !empty($blok4a)}<div class="blok">{$blok4a}</div>{/if}
    {content block='blok4b' assign='blok4b'}{if !empty($blok4b)}<div class="blok">{$blok4b}</div>{/if}
{content block='blok4c' assign='blok4c'}{if !empty($blok4c)}<div class="blok">{$blok4c}</div>{/if}
{content block='blok4d' assign='blok4d'}{if !empty($blok4d)}<div class="blok">{$blok4d}</div>{/if}
{content block='blok4e' assign='blok4e'}{if !empty($blok4e)}<div class="blok">{$blok4e}</div>{/if}
</div>

      </div>
</div>
<div class="footer">
</div>

<__body>
</__html>

Re: error when adding page with several content fields

Posted: Wed May 26, 2010 1:59 pm
by baresi
You must have one just {content} (unnamed block)

Re: error when adding page with several content fields

Posted: Wed May 26, 2010 3:05 pm
by Fraserm
As above, you need to have one plain {content} block, that isn't named in the way your others are, and it's that block that must contain some form of content.

You can use the label parameter though, e.g. {content label="Required"}, so that your users will see a meaningful label in the backend and also know that they must enter something in there for it to be accepted.

Re: error when adding page with several content fields

Posted: Wed May 26, 2010 3:47 pm
by crosmuller
Thanks for the quick response, it works now :)