Problems, need help? Have a tip or advice? Post it here.
5 posts Page 1 of 1
I am pretty new to CMS having been an 'amateur' dabbler in html code to write a website for a local charity I'm a part of. I'm now wanting to give others the option to update the website so it isn't just me and CMS seemed the perfect solution. I'm having a couple of probably basic issues with things that I want to do but am struggling with:

1. Template in a clonable page

The website has lots of individual pages for shows (it's a musical theatre charity) that have been performed and I want to easily give them the option to add a new page for a show. So I've set up a clonable page so that they can add their content and an image and that is working fine. But, I'd like to make it such that when they click "Add new" they get a previous version of the page that they can just overwrite (there are certain colours that they may want to keep that they can't easily do from a blank content box - see query 2!). I'm pretty sure that it is possible, but I just don't seem to be able to do it! Any help on that one will be much appreciated.

2. Add option to change colour of font
I have a feeling this is much harder...but the 'style' of the site is that it uses a specific green when writing the name of the charity and the name of a show. So I'd really like to give them the option to change a couple of words to be that colour. I looked around in these forums and on the web generally and then played around with setting up some separate .css files etc, but all I could manage was to get the heading styles to be that colour or to change the whole paragraph to that colour by changing the 'Normal' style. To be honest, this isn't the end of the world, but I'm quite enjoying trying to dabble around with this so I thought I'd ask if there is a way to do it!

Any help gratefully received!

Nick
Hi Nick :)

I'll try to answer your queries.

1. I think you can get that by using 'default contents' with the editable regions.
For text regions (e.g. type 'text', 'textarea', 'richtext'), whatever content is enclosed between the opening and closing tags becomes the default text that is offered on creating a new page e.g.
Code: Select all
<cms:editable type='richtext' name='test'>
   <h3>Hello! This is some default text </h3>
</cms:editable>

For regions like dropdown, radio and checkbox, you can use the 'opt_selected' parameter to pre-select options e.g.
Code: Select all
<cms:editable name="my_categories" label="Categories" desc="Check all applicable"
  opt_values='Entertainment | Computers | Sports | Health'
  opt_selected = 'Sports'
  type='checkbox'
/>


2. This shouldn't be difficult once the use-case is clear.
Could you please post the HTML markup of the portions where you wish to allow the color change?
Are there several such portions in the template? Please let me know and we can take it forward then.
Great. Thank you. I was doing the editable regions using the option of putting something like <cms:editable name='content' type='richtext' /> at the start of the page and then <cms:show content /> at the relevant place. So I was struggling to work out how to put default text in - but there's no need for me to use that option, so I have changed it as you suggested and all is fine.

For the second query, it isn't necessarily in the 'clonable' page but in any page where i have editable content. Let's say I have something simple like:
Code: Select all
<FONT size="3" face="Arial" color="#00af1d"><B>Havering Music Makers</B></FONT><FONT size="2" face="Arial">were founded in 1975. Initially we presented two productions each year, but in 1994 we increased this to three. 

So, if someone else was changing this in CMS they can just overwrite it, so all is good. But what if, for some reason, they wanted to change the words 'two productions' to be the same colour as Havering Music Makers? I'd like to give them the option of doing that without going into the code and changing it using html code. Is that possible? Please let me know if still not clear.

Also, something else I have just come up against is that when I hit save within the CMS it will change a quotation mark to the code for quotation mark, even when I don't want it to, like when it is within javascript. So, I have this:
Code: Select all
<a class="twitter-timeline" data-dnt="true" href="https://twitter.com/HMM76"  data-widget-id="354302897200168961">Tweets by @HMM76</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>

If I had this in the CMS and then hit save, it will change the quotation marks to code:
Code: Select all
<a class="twitter-timeline" data-dnt="true" data-widget-id="354302897200168961" href="https://twitter.com/HMM76">Tweets by @HMM76</a> &lt;script type=&quot;text/jaxxxvascxxxript&quot;&gt;!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?&#39;http&#39;:&#39;https&#39;;if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+&quot;://platform.twitter.com/widgets.js&quot;;fjs.parentNode.insertBefore(js,fjs);}}(document,&quot;script&quot;,&quot;twitter-wjs&quot;);&lt;/script&gt;

...and then the script doesn't work any more. I have gotten around this at the moment by just not making it editable because, to be honest, they won't need to edit it but I wondered if I was missing something obvious.

Thanks again!
Nick, most designers would be wary of granting their clients the ability to change the color/font/background-color of their carefully crafted designs.

But if that is what someone wants, you can use type 'richtext' editable region to make that text editable. Make sure to set the 'toolbar' parameter of the region to 'full' - please see http://docs.couchcms.com/tags-reference ... .html#full and you'll find that the toolbar now offers buttons that the client can use to unleash total carnage on your design :)

Regarding the other issue - that is by design actually. Couch, as a security measure, only allows a safe subset of characters as input. The rest are 'sanitized' as you have seen.

For use-cases where you have to allow the client to update 'code' (e.g. adsense or YouTube), there are two options -
1. Use type 'textarea' editable region with 'no_xss_check' parameter set to '1'.
2. For richtext regions, use 'shortcodes' - one useful implementation is this: viewtopic.php?f=8&t=7950

Hope it helps.
Thanks KK! This is perfect!
5 posts Page 1 of 1