Page 1 of 1
[SOLVED] Cannot edit CSS that is embedded in content
Posted: Wed Jul 18, 2012 5:37 pm
by Oswy
I've been using CMSms for all of a day, and have the job of moving a small web site to it, from free standing pages (using Smarty). I have created a template, along with its CSS, that seems to perform quite well and matches what we see on the existing pages. My problem lies with the content of my first page (our home page). The content appears, more or less as it should, but the CSS doesn't behave as expected. I'm happy to take the blame for that, at least for the time being, but how can I edit the CSS, which is embedded in the content as a large chunk of
Code: Select all
{literal}<style>...</style>{/literal}
code? All I see in the content editor is
- no <style>.
A further question arising out of this, is, whether or not CMSms injects any of its own CSS into the template expansion, or can I rely on the only CMS being present, coming from my template and my content? If there is any additional CSS, can I suppress it?
For the avoidance of doubt, I have v1.10.3 installed
Thanks in anticipation,
Oswy
Re: Cannot edit CSS that is embedded in content
Posted: Wed Jul 18, 2012 5:53 pm
by calguy1000
1. I suggest you read the default content pages that come with CMSMS. They explain a great deal of how CMSMS works with pages and content and styles.
2. styles should NEVER be embedded into content areas. You need to understand the concept of separation of design and content.
3. WYSIWYG editors are not text editors. They will strip out tags they don't understand, and TinyMCE and MicroTiny (both based on tinymce) will both do this.
Re: Cannot edit CSS that is embedded in content
Posted: Wed Jul 18, 2012 8:33 pm
by Oswy
Thanks calguy1000. As a study of these forums reveals, you are a principle and well respected contributer. So I suspect that I may be suffering concept failure. Let be address your points from my point of view and then you can tell me where I've got it wrong.
1. I suggest you read the default content pages that come with CMSMS. They explain a great deal of how CMSMS works with pages and content and styles.
Yep, I've done that twice now and can only find a couple of references to using style sheets. In particular it appears they can only be included via
{cms_stylesheet} in the template.
2. styles should NEVER be embedded into content areas. You need to understand the concept of separation of design and content.
Yes I understand that concept well, and generally adhere to it (though I note that the minimal template included with the default content, doesn't adhere to that rule). In our case we have the main style sheet embedded in our Smarty header template (as per concept), but one page requires quite a bit of additional CSS. It would be inefficient to include this in the main CSS, just for the sake of one page. So we include that in the header template using a bit of Smarty code that detects the page that the header is part of.
Now, using
{cms_stylesheet} how can I conditionally include that style sheet for this one-off page? I couldn't see a way so tried to include it as chunk of style at the head of the content. This appears to be me, to be a no-no with CMSms, I hope I'm wrong.
3. WYSIWYG editors are not text editors. They will strip out tags they don't understand, and TinyMCE and MicroTiny (both based on tinymce) will both do this.
That seems entirely reasonable under the circumstances, though I did rather expect that it would have shown up with HTML turned on, but alas no.
Thanks once again for your speedy response.
Oswy
Re: Cannot edit CSS that is embedded in content
Posted: Thu Jul 19, 2012 11:42 am
by uniqu3
If you still have the "need" to add inline styles in Editor area, then create new "Global Content Block" turn WYSIWYG completly off for that GCB and enter your Style, then simply in your "Content" you would add it with something like {global_content name='my_funky_style'}.
Also you can always add extra styles in "Options -> Page Specific Metadata" exactly with {literal}<style>...</style>{/literal} but your {metadata} in Page Template should be called after {cms_stylesheet} or you would be overriding it again.
In same area you can add additional stylesheet simply by calling cms_stylesheet again for example {cms_stylesheet name='style_to_add'}
[SOLVED]Re: Cannot edit CSS that is embedded in content
Posted: Thu Jul 19, 2012 1:52 pm
by Oswy
Thanks unique3. That's the solution I needed. I inserted {cms_stylesheet name='style_to_add'} at the top of the {content} and all worked well.
After only a couple of days on CMSms, I am amazed at the versatility of the system. I look forward to exploring more of it.
Oswy
Re: [SOLVED] Cannot edit CSS that is embedded in content
Posted: Sun Jul 22, 2012 6:10 pm
by Dr.CSS
Embedding the style sheet in the "content" will give you validation errors you are better off adding the style sheet call in the page options metadata box so it ends up in the <head>...