| Author |
Message |
![[Post New]](/forum/templates/default/images/icon_minipost_new.gif) 19/07/2010 17:37:25
|
shriniarole
Initiate
Joined: 19/07/2010 14:50:25
Messages: 4
Offline
|
In order to format the view effectively, I am using a server-side script as follows:
mytxt='<style type="text/css">.PCMSBox {'
mytxt+='height: 70px;'
mytxt+='width: 70px;'
mytxt+='border: 2px solid orange;'
mytxt+='background-color: yellow;'
mytxt+='text-align:center;'
mytxt+=' font-size: 20px;'
mytxt+=' font-weight: bold;'
mytxt+='}</style>'
mytxt+='<div class="PCMSBox">'
mytxt+=htmlText
mytxt+='</div>'
return mytxt
This formats the point value into a 70x70 box for display. Is there any way to put the CSS style declaration in a file so that it is available client side? This way, if I decide to change the border from orange to green, for example, I wouldn't have to change the script for each point, but rather just change 1 css definition. I tried to add to common.css and include the css in the html script, but it did not work for some reason.
|
|
|
 |
![[Post New]](/forum/templates/default/images/icon_minipost_new.gif) 21/07/2010 11:24:43
|
mlohbihler
![[Avatar]](/forum/images/avatar/eccbc87e4b5ce2fe28308fd9f2a7baf3.png)
Joined: 01/03/2007 22:48:52
Messages: 974
Offline
|
Putting your CSS in common.css should work.
|
Best regards,
Matthew Lohbihler |
|
|
 |
![[Post New]](/forum/templates/default/images/icon_minipost_new.gif) 21/07/2010 12:46:16
|
shriniarole
Initiate
Joined: 19/07/2010 14:50:25
Messages: 4
Offline
|
I got the effect I needed.. but not through the common.cs
I discovered that if I had a server-side script on the view that had a style definition in it, I could use that definition in any html/script tag on the view. So -- I just created a placeholder server side script to hold the css and used those style defs in the other points..
I'd still prefer to use common.cs though -- so I'll play with that some more. So far, no luck though.
|
|
|
 |
![[Post New]](/forum/templates/default/images/icon_minipost_new.gif) 21/07/2010 13:07:39
|
mlohbihler
![[Avatar]](/forum/images/avatar/eccbc87e4b5ce2fe28308fd9f2a7baf3.png)
Joined: 01/03/2007 22:48:52
Messages: 974
Offline
|
Putting your styles in a view element will work, but of course only on that view.
|
Best regards,
Matthew Lohbihler |
|
|
 |
![[Post New]](/forum/templates/default/images/icon_minipost_new.gif) 21/07/2010 13:10:59
|
shriniarole
Initiate
Joined: 19/07/2010 14:50:25
Messages: 4
Offline
|
Ah! Got it to work. Stupid mistake. I add a comment to the CSS before my declaration and used the hash mark (too much shell scripting lately) rather than the /* */ comment... Once I changed that, it works great.
In case anyone else wants to do, here is what I did:
common.css as following lines:
/* custom CSS -- S. Arole. */
.PCMSBox {
height: 70px;
width: 70px;
border: 2px solid orange;
background-color: yellow;
text-align:center;
font-size: 20px;
font-weight: bold;
}
and the server-side script tag has the following:
mytxt='<div class="PCMSBox">'
mytxt+=htmlText
mytxt+='</div>'
return mytxt
Thanks!
|
|
|
 |
|
|