[SOLVED]CSS code has been removed

For discussion and questions related to CMS Specific templates and stylesheets (CSS), and themes. or layout issues. This is not a place for generic "I don't know CSS issues"
Post Reply
dmaireroa
Forum Members
Forum Members
Posts: 110
Joined: Wed Jul 15, 2009 12:35 am

[SOLVED]CSS code has been removed

Post by dmaireroa »

Hi there

I am using cmsms version 1.9.4.2. I noticed some of my html/css code have been erased for some reason on live view.

Here is the link:
http://www.bringitondance.com/aus-bring ... sbane.html

Here is the issue that I have highlighted:

Code: Select all

<div class="AU-home">
	<div class="wrraper">
    	<div class="TOP">
        	<a href="nz-auckland.html" class="blue">NZ</a> <a href="aus-brisbane.html"><img src="images/AU-flag.jpg" /></a>
		<a href="#">SITEMAP</a> | <a href="#">CONTACT US</a>
        </div>		
<div class="clear1"></div>
        <!-- .Top - Top Navigation -->
        
        <div class="header">
        	<div class="fl">
        	<a href="nz-auckland.html"><img src="images/AUS.jpg" /></a>
<div class="clear"></div><div class="clear1"></div>
If you view the link, it is not showing the div tag class for 'clear1' and 'clear'??

Any suggestions?

Thanks in advance
CHEERS :)
Last edited by dmaireroa on Wed Jun 15, 2011 8:35 am, edited 1 time in total.
chrismarie

Re: CSS code has been removed

Post by chrismarie »

Odd, normally the empty div problem has to do with TinyMCE, but this html looks like it goes in your template, not in a content block. Have you tried adding a non-breaking space

Code: Select all

<div class="clear">nbsp;</div>
in your clearing divs?
dmaireroa
Forum Members
Forum Members
Posts: 110
Joined: Wed Jul 15, 2009 12:35 am

Re: CSS code has been removed

Post by dmaireroa »

chrismarie wrote:Odd, normally the empty div problem has to do with TinyMCE, but this html looks like it goes in your template, not in a content block. Have you tried adding a non-breaking space

Code: Select all

<div class="clear">nbsp;</div>
in your clearing divs?
Thanks Chrismarie, it actually worked but 'nbsp;' text was showing so I added

Code: Select all

text-indent:-9999px;
to the css.

Too easy ;)
Jos
Support Guru
Support Guru
Posts: 4019
Joined: Wed Sep 05, 2007 8:03 pm

Re: [SOLVED]CSS code has been removed

Post by Jos »

try &nbsp;
dmaireroa
Forum Members
Forum Members
Posts: 110
Joined: Wed Jul 15, 2009 12:35 am

Re: [SOLVED]CSS code has been removed

Post by dmaireroa »

Jos wrote:try &nbsp;
lol flip no wonder, I had the wrong non-breaking space.
Thanks Jos, now I can remove the 'text-indent' style ;)
chrismarie

Re: [SOLVED]CSS code has been removed

Post by chrismarie »

Sorry! I added the div tags and deleted the ampersand by mistake! Glad it worked out :)
dmaireroa
Forum Members
Forum Members
Posts: 110
Joined: Wed Jul 15, 2009 12:35 am

Re: CSS code has been removed

Post by dmaireroa »

Hey guys, one slight problem now. Every time I update any of those pages, all those div tags with 'clear' classes have been removed :(

With a lot of testing, I went back to the original text-indent: -9999px; and added a text. Now when I update the page, it works fine. However, the only minor problem is having those pages with extra keywords. I guess it will do for now ;)
chrismarie

Re: [SOLVED]CSS code has been removed

Post by chrismarie »

So, I'm a bit confused...you have that code:

Code: Select all

<div class="AU-home">
   <div class="wrraper">
       <div class="TOP">
           <a href="nz-auckland.html" class="blue">NZ</a> <a href="aus-brisbane.html"><img src="images/AU-flag.jpg" /></a>
      <a href="#">SITEMAP</a> | <a href="#">CONTACT US</a>
        </div>      
<div class="clear1"></div>
        <!-- .Top - Top Navigation -->
       
        <div class="header">
           <div class="fl">
           <a href="nz-auckland.html"><img src="images/AUS.jpg" /></a>
<div class="clear"></div><div class="clear1"></div>
in the actual content of each page with the WYSIWYG editor? If so, that's bad news bears. You want that stuff to live in your template, not your content. If nothing else, at least drop those bits into global content blocks, turn of the WYSIWYGs on the GCB and then plop the GCB into your page content so you don't have to worry about Tiny stripping your empty clearing divs. Let me know if you need step by step elaboration.
dmaireroa
Forum Members
Forum Members
Posts: 110
Joined: Wed Jul 15, 2009 12:35 am

Re: [SOLVED]CSS code has been removed

Post by dmaireroa »

chrismarie wrote:So, I'm a bit confused...you have that code:

Code: Select all

<div class="AU-home">
   <div class="wrraper">
       <div class="TOP">
           <a href="nz-auckland.html" class="blue">NZ</a> <a href="aus-brisbane.html"><img src="images/AU-flag.jpg" /></a>
      <a href="#">SITEMAP</a> | <a href="#">CONTACT US</a>
        </div>      
<div class="clear1"></div>
        <!-- .Top - Top Navigation -->
       
        <div class="header">
           <div class="fl">
           <a href="nz-auckland.html"><img src="images/AUS.jpg" /></a>
<div class="clear"></div><div class="clear1"></div>
in the actual content of each page with the WYSIWYG editor? If so, that's bad news bears. You want that stuff to live in your template, not your content. If nothing else, at least drop those bits into global content blocks, turn of the WYSIWYGs on the GCB and then plop the GCB into your page content so you don't have to worry about Tiny stripping your empty clearing divs. Let me know if you need step by step elaboration.
I see what you mean now, I totally forgotten about the 'global-content-block'. I haven't used cmsms for a while now. Trying to remember how to add 'GCB' inside the div tag with a css class for a navigation e.g. <li class="active"></li>?

P.S I forgot to mention why i didn't this way. I have a different bg images on some other pages. So I thought I'll chuck it all in the WYSUWYG editor without the hassle lol.

One last question, can you assign one template to certain pages and use another template for other pages?
chrismarie

Re: [SOLVED]CSS code has been removed

Post by chrismarie »

I'm going to bounce around a bit, so stick with me...

To answer your last question, totally! You set the template under the options tab on the page or in the page list view at Content > Pages, you tick the box next to the page you want to change and then select "Set Template" from the "With Selected:" dropdown.

If the only reason you'd need additional templates is to use a different BG image on each page, then you can solve that issue either using CSS or a content block.

If you were going to use CSS, you could give the body of each page a unique id based on the page alias like so:

Code: Select all

</__body id="{$page_alias}">
or you could use the page alias to give the div in question a unique id or add a unique class, doesn't really matter. Then in your CSS, if your page alias was for instance, "home" and you wanted the background image AU-bg.jpg to display as the body background, you would put the following in your CSS:

Code: Select all

body#home {background: #000000 url("../images/AU-bg.jpg") no-repeat top center;}
You can use the page alias body id to give your image links different CSS for the current page. For example, if I had the following two list items:

Code: Select all

<li class="homenav">Home</li>
<li class="aboutnav">About</li>
and I wanted the current page text to display as the color red, I could use the page alias that I set for the body id in the previous example to style my CSS like so:

Code: Select all

body#home li.homenav, body#about li.aboutnav {color:red;}
Get it?

If you don't want to use the page alias, you could also insert a content block into your template to put in the background image name or a class or whatever.

Code: Select all

<div class="{content block="Background Image Class" wysiwyg="false" oneline="true"}">
That'll give you a field called "Background Image Class" to fill out on each page. You could even give it some default content just in case you didn't fill it out on every page, or you could use a smarty conditional statement to only use the content block if it has content like this:

Code: Select all

{content block="Background Image Class" assign="image" wysiwyg="false" oneline="true"}
{if !empty($image)}
<div class="{$image}">
{else}
<div class="default">
{/if}
The global content blocks provide you with the tags to use them in your content - if I made a block named "Links" then I could place it in my template or page with

Code: Select all

{global_content name='Links'}
If you have multiple templates, it would be a good idea to put universal elements like your links in a GCB so you don't have to update each template each time you make a change.

I hope that's not too confusing.
dmaireroa
Forum Members
Forum Members
Posts: 110
Joined: Wed Jul 15, 2009 12:35 am

Re: [SOLVED]CSS code has been removed

Post by dmaireroa »

That is awesome Chrismarie. It took me some time to figure this one out but finally got it.

I added most of my code in the template and created a new template and some GCB which is a lot easier with different pages in other cities. However, the non-breaking space is still not work properly within the WYSIWYG panel, only inside the template. That's ok, it is heaps better than it was before. At least it's only a few of them in the WYSIWYG panel compared to the whole site I had before lol.
chrismarie

Re: [SOLVED]CSS code has been removed

Post by chrismarie »

Yay! ;D

Screw the non breaking space, then. Create a 1px by 1px transparent gif named blank.gif and then place it in your clearing divs:

Code: Select all

<div class="clear"><img src="blank.gif" alt=""></div>
It won't show up on the frontend, and won't disappear on the back. Happy trails!
dmaireroa
Forum Members
Forum Members
Posts: 110
Joined: Wed Jul 15, 2009 12:35 am

Re: [SOLVED]CSS code has been removed

Post by dmaireroa »

chrismarie wrote:Yay! ;D

Screw the non breaking space, then. Create a 1px by 1px transparent gif named blank.gif and then place it in your clearing divs:

Code: Select all

<div class="clear"><img src="blank.gif" alt=""></div>
It won't show up on the frontend, and won't disappear on the back. Happy trails!
Thanks again Chrismarie, it works ;)
Why didn't I think of that before ;D
Post Reply

Return to “Layout and Design (CSS & HTML)”