Forum for discussing general topics related to Couch.
5 posts Page 1 of 1
When the client logs in and wants to make changes to a page, how can the developer ensure that formatting is retained?

For example, using the Aurelius example, if one changes something at the top of the side panel the whole formatted layout is destroyed after saving the changes. Looking at the source code, the developer can see that the formatting is done with a dl tag. However, that's beyond what client's might be expected to handle.

Also, is there a way one can provide the facility for the client to just add a line break, <br /> for example, rather than a large gap with a paragraph change?

Hope I'm not missing the obvious! TIA
Hi
Aurelius tutorial has this first page http://docs.couchcms.com/tutorials/port ... ut-us.html which is meant to show the renown simplicity of CouchCMS. Sidebar code is surrounded with the editable tags - content is 'editable' in backend and it's a great example.

If you follow through the tutorial up to the very end, you'll see many places where things go the different way - narrowing down to editing only content, leaving html outside of question. The file index.php for instance has code which keeps markup indestructible and content editable :
Code: Select all
<h4 class="title "><cms:editable name='box1_title' label='Title' group='box1_group' type='text'>Recent Work</cms:editable></h4>
<p><cms:editable name='box1_text' label='Text' group='box1_group' type='textarea'>Cras vestibulum lorem et dui mollis sed posuere leo semper.</cms:editable></p>


If you wish, you may rewrite those main_content / sidebar_content parts of about.php and achieve exactly that - only content editable - with the help of repeatable regions.

Original source:
Code: Select all
<!-- Column 2 / Sidebar -->
<cms:editable name='sidebar_content' type='richtext'>
<div class="grid_4">

    <h4>Our History</h4>
    <div class="hr dotted clearfix">&nbsp;</div>
    <dl class="history">
        <dt>1994</dt>
        <dd>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vel diam id mauris accumsan egestas. Sed sed lorem. Integer id mi vel sapien fermentum vehicula. Pellentesque vitae lacus a sem posuere fringilla. Vestibulum dolor.</dd>
   
        <dt>1996</dt>
        <dd>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vel diam id mauris accumsan egestas. Sed sed lorem. Integer id mi vel sapien fermentum vehicula. Pellentesque vitae lacus a sem posuere fringilla. Vestibulum dolor.</dd>
   
        <dt>2000</dt>
        <dd>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vel diam id mauris accumsan egestas. Sed sed lorem. Integer id mi vel sapien fermentum vehicula. Pellentesque vitae lacus a sem posuere fringilla. Vestibulum dolor.</dd>
   
        <dt>2003</dt>
        <dd>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vel diam id mauris accumsan egestas. Sed sed lorem. Integer id mi vel sapien fermentum vehicula. Pellentesque vitae lacus a sem posuere fringilla. Vestibulum dolor.</dd>
   
        <dt>2009</dt>
        <dd>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vel diam id mauris accumsan egestas. Sed sed lorem. Integer id mi vel sapien fermentum vehicula. Pellentesque vitae lacus a sem posuere fringilla. Vestibulum dolor.</dd>
    </dl>
</div>
</cms:editable>


Can have indestructible markup with following changes (with definition of repeatable region placed inside cms:template block as usual ):
Code: Select all
<!-- Column 2 / Sidebar -->
<div class="grid_4">
    <h4>Our History</h4>
    <div class="hr dotted clearfix">&nbsp;</div>
    <dl class="history">
        <cms:show_repeatable 'our_history' >
            <dt><cms:show year /></dt>
            <dd><cms:show history_blurb /></dd>
        </cms:show_repeatable>
    </dl>
</div>


The only caveat is that actual content - year and history data must be re-entered to backend. If you are given a content-rich website with a lot of data, that might take some time to input. Hopefully it doesn't scare you off. The goal with this post is to show how keep layout clean and organized and give the client take care of data, not layout.
@oldcelt, if I may add to what @trendoman has very extensively covered -
for rare cases where even repeatable-regions do not suffice, you may try using 'mosiac' - viewtopic.php?f=4&t=11690&p=31445#p31445.

The docs can be found there - viewtopic.php?f=5&t=11105
Many thanks for both replies. I must do my homework more thoroughly! ;)

PS: Although I've set my profile to ask for notifications of replies, I don't seem to be getting them?
Doesn't seem to be an 'Edit' option so replying to my own message. I've now started getting notification of replies. :oops:
5 posts Page 1 of 1