[SOLVED] Cannot edit CSS that is embedded in content

General project discussion. NOT for help questions.
Post Reply
Oswy
New Member
New Member
Posts: 3
Joined: Wed Jul 18, 2012 3:35 pm

[SOLVED] Cannot edit CSS that is embedded in content

Post 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

Code: Select all

{literal}{/literal}
- 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
Last edited by Oswy on Thu Jul 19, 2012 1:58 pm, edited 1 time in total.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: Cannot edit CSS that is embedded in content

Post 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.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Oswy
New Member
New Member
Posts: 3
Joined: Wed Jul 18, 2012 3:35 pm

Re: Cannot edit CSS that is embedded in content

Post 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
uniqu3

Re: Cannot edit CSS that is embedded in content

Post 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'}
Oswy
New Member
New Member
Posts: 3
Joined: Wed Jul 18, 2012 3:35 pm

[SOLVED]Re: Cannot edit CSS that is embedded in content

Post 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
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: [SOLVED] Cannot edit CSS that is embedded in content

Post 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>...
Post Reply

Return to “General Discussion”