Saud
|
| Posted: 03/18/2003, 7:20 AM |
|
I do not if this is a bug or a feature of CCS 2.0 ..
Whenever I add a "Label" through the HTML View window, and the label is not placed between proper HTML tags, CCS flag this label as a label not used in HTML during the sychronization and deletes it.
For example, I want to give every row that contains a specific field value a specific color. I added a label to the <tr> tag to look like this:
<tr{rowcolor}>
And in the events section, I added a "Before Show" code to determine if the value is met for this row. If it was met, then "rowcolor.value" will become something like : " bgcolor="#cecece" .. otherwise it will not be assigned a value.
Strangely, CCS deletes the "rowcolor" label, and replaces the <tr{rowcolor}> with a new <tr>.
I am not sure if I have missed anything in here ... but your thoughts and input would be highly appreciated.
Regards,
Saud
|
|
|
 |
RonB
|
| Posted: 03/18/2003, 4:30 PM |
|
try using styles. just set some atribute and add the backgroundcolor stuff. since the style element was inserted by ccs it should survuve the code generation without being deleted.
Ron
|
|
|
 |
Saud
|
| Posted: 03/19/2003, 4:14 AM |
|
Ron,
Thanks for your reply.
But styles can not be set "dynamically"!
Saud
|
|
|
 |
RonB
|
| Posted: 03/19/2003, 5:46 AM |
|
aha, but if you are clever...
all you have to do is set add a grid(no borders etc.) instead of labels you use hidden fields(you also could add the hiddefields to the grid you are using). Set the values for the hidden fields(being the colorcodes)and remember the names of the hidden fields. Here I'll call it testcolor
now right click on the td and set a color for that row. Switch to html, remove the color and add the controlname -> bgcolor="{testcolor}"
Now the td will have the bgcolor you specified in the hiddenfield that retrieves it from the database. 
Ron
|
|
|
 |
RonB
|
| Posted: 03/19/2003, 6:10 AM |
|
Oh.., you could also use an event to pump a colorcode to the template but that's still one area I'm not to familiar with yet, maybe someone else could explain that here(for me as well 
Ron
|
|
|
 |
RonB
|
| Posted: 03/19/2003, 6:25 AM |
|
Sorry but I just remembered. In the beta4 version of CCS you can do the folowing:
click on page, click on events, click on before show event, choose add action. From the list of actions choose set tag. Now in prperties give te tag a name (testcolor) and set a value in expression '#FFFF66'. Now the {testcolor} will be passed to the page via template. Now ..this is not dynamic..., I can here you say. Well...not yet.
click on the beforeshow in the events list and choose show code. This will look something like:
Set Tag @14-7B5B3D4D
global $Tpl;
$Tpl->SetVar("test1", '#FFFF66');
//End Set Tag
edit this code by getting the value from the database:
Set Tag @14-7B5B3D4D
global $Tpl;
global $DBConnection1;
$my_color=CCGetDBValue(select somecolor from my_color_table where bla = blabla",$DBConnection1));
$Tpl->SetVar("test1", $my_color);
//End Set Tag
That's all. Tried it and it works like a charm
Ron
|
|
|
 |
|