[Chameleon] Table widget

Paul Spencer pagameba at magma.ca
Thu Sep 16 08:07:32 EDT 2004


Berend,

this is because we use an xml parser to parse this stuff, it is not 
valid to put (for instance) content="<table>" ... the standard XML way 
of encoding this stuff is:

<template name="header"><![CDATA[
<table>
]]></template>
<template name="body"><![CDATA[
<tr>
  <td>%colname_1%</td>
  <td>%colname_2%</td>
</tr>
]]></template>
<template name="footer"><![CDATA[
</table>
]]></template>


the <![CDATA[  ...   ]]> is an XML construct that tells an XML parser to 
treat the contents as character data and not try to interpret it as XML.

Cheers,

Paul

Berend Veldkamp wrote:

> Hm, that's strange... When I try that, nothing is displayed at all. As 
> a matter of fact, I can't seem to use any html tags.
>
> After some experimenting I found out I need to use &lt; and &gt; 
> instead of < and > in my chameleon template, so this works for me:
>
> <cwc2 type="table" start="0" count="10" sharedresourcename="SQLQuery" >
>    <TEMPLATE Name="HEADER" Content="&lt;table&gt;&lt;tr&gt;"/>
>    <TEMPLATE Name="BODY" 
> Content="&lt;td&gt;%colname_1%&lt;/td&gt;&lt;td&gt;%colname_2%&lt;/td&gt;"/> 
>
>    <TEMPLATE Name="FOOTER" Content="&lt;/tr&gt;&lt;/table&gt;"/>
> </cwc2>
>
> Or is there an easier way?
>
> Berend
>
>
> Julien-Samuel Lacroix wrote:
>
>> Here's what you need:
>> <cwc2 type="table" sharedresourcename="MyResult" >
>>    <TEMPLATE Name="HEADER" Content="<table><tr>"/>
>>    <TEMPLATE Name="BODY" 
>> Content="<td>%col_name1%</td><td>%col_name2%</td><td>etc...</td>"/>
>>    <TEMPLATE Name="FOOTER" Content="</tr></table>"/>
>> </cwc2>
>>
>> The [html_content] should be...html. The body will be repeated for 
>> each row in your shared resource. So if MyResult contains:
>> col_name1  |  col_name2
>> ------------------------
>> Joe        |  123
>> Bill       |  456
>> Jack       |  789
>>
>
>


More information about the Chameleon mailing list