Page 1 of 1

[SOLVED] Conditional content design strategy question

Posted: Wed Apr 16, 2008 6:58 am
by gbrose85
Very new to CMSMS -- been reviewing examples and documentation, but cannot see how best to handle this structure:

A primary content div contains multiple divs of standard description (Intro, Features, Use, ScreenShot, Install, FAQ, etc.). Each of these "sub-divs" will contain different internal styling, so not analogous to News (I think).  The trick is, all site web pages will not contain the complete (or same) set of sub-divs.  The number of sub-divs per page may also be different.  Desirable, but not essential, to have the relative order of the sub-divs to be set differently for different pages.

So, how to cleanly show just the sub-divs that actually contain content.  I realize that I could use a single content block per page to literally contain the page's sub-divs, but that just seems rather inelegant. 

Is there a conditionally included named content block?  Or a clean way to achieve the same effect?

TIA!




Introduction
Text blocks.



Features
feature list



ScreenShot
content 3



Re: Conditional content design strategy question

Posted: Wed Apr 16, 2008 6:35 pm
by Pierre M.
Hello,

I don't understand what you are looking for. Could you please explain from the sample content (or themes site) which of the default templates come closest to what you want and why they are not what you want ?

Pierre M.

Re: Conditional content design strategy question

Posted: Wed Apr 16, 2008 9:37 pm
by gbrose85
The generic template structure for a group of pages will be:


{content block="introduction"}
{content block="features"}
{content block="use"}
{content block="install"}
{content block="screenshot"}
{content block="acknowledgements"}
{content block="subprojects"}
{content block="faq"}
{content block="devhistory"}


The problem is, not all pages will have all content blocks; some will not have a devhistory or faq or subprojects, etc.  (Basic static version of site I am looking to convert to CMSMS is www.certiv.net)

This can still work if I put all of the local surrounding html markup into the content blocks themselves.  As outlined in the first message, the html markup for each content block includes nested divs and other markup to support css top and bottom images, etc.  The html markup is not/will not be identical for all of the content block types -- "screenshot" will have different local markup as compared to "install". 

While the html markup will not be overly complicated, I would prefer to have it fixed directly in the template rather than duplicated in each of the content blocks.  While separating view from data is a good thing, my more practical concern is not to chance screwing up the markup each time I go into edit content as well as avoid duplication of the markup.

So, what I am looking for (simplified) is how to do something like:



...
{include_content block="features" if="not_empty"}

{content block="features'}

{/include_content}
...



where everything between {include_content}{/include_content} is completely omitted from the page production if the named content block is empty.

Is there a way to define conditional content or is there a better strategy to use?

Thanks,
Gerald

Re: Conditional content design strategy question

Posted: Wed Apr 16, 2008 9:42 pm
by calguy1000
{content block='blah' assign='blah'}
{if !empty($blah)}
{$blah}
{/if}

Re: Conditional content design strategy question

Posted: Wed Apr 16, 2008 11:13 pm
by gbrose85
Nice.  Thanks...

Re: Conditional content design strategy question

Posted: Wed Apr 16, 2008 11:15 pm
by calguy1000
solved? if so, mark it as so please.

Re: [SOLVED] Conditional content design strategy question

Posted: Wed Mar 11, 2009 5:29 pm
by bryan
I found this post when I had trouble making some updates to an older site using the oneline attribute. The site is running:
  • CMSMS 1.3
    PageBlocks 0.1.5
I had to use the following to make it work:

Code: Select all

{capture assign="blah"}{content block="Blah Name" oneline="true"}{/capture}

{if !empty($blah)}
<div id='blah'>{$blah}</div>
{/if}
As always, thanks for your help, Calguy1000!  :)