Hi all...
How is possible to create a template in order to show a dynamic html table? (i.e. a table with variable number of cols and rows )
e.g.
{{TableTemplate | nrow=3 | ncol=2 | C11 | C12 | C21 | C22 | C31 | C32 }}
<table> <tr><td>C11</td><td>C12</td></tr> <tr><td>C21</td><td>C22</td></tr> <tr><td>C31</td><td>C32</td></tr> </table>
{{TableTemplate | nrow=1 | ncol=2 | C11 | C12 }}
<table> <tr><td>C11</td><td>C12</td></tr> </table>
etc. etc.
I tried with LoopFunctions, but with no success... I think that the problem is related on how the parser manages the tags.
Thanks
Giuseppe
--
Giuseppe Briotti g.briotti@mclink.it
"Alme Sol, curru nitido diem qui promis et celas aliusque et idem nasceris, possis nihil urbe Roma visere maius." (Orazio)
Well, if you want to cheat, and not get your hands dirty on rolling your own extension, you can use a bunch of <div> elements, floated left, with static dimensions contained within a static width <div> container.
So for example, consider the HTML:
<div style="width:200px"> <div style="width:50px;height:50px;float:left"> C11 </div> <div style="width:50px;height:50px;float:left"> C12 </div> <div style="width:50px;height:50px;float:left"> C13 </div> <div style="width:50px;height:50px;float:left"> C14 </div> <div style="width:50px;height:50px;float:left"> C21 </div> <div style="width:50px;height:50px;float:left"> C22 </div> <div style="width:50px;height:50px;float:left"> C23 </div> <div style="width:50px;height:50px;float:left"> C24 </div> </div>
Obviously you're not going to want to write all that, so you can make templates for the wrapper and the internal elements.
The wikitext would then look something like this:
{{box|width:200px| {{c| C11 }} {{c| C12 }} {{c| C13 }} {{c| C14 }} {{c| C21 }} {{c| C22 }} {{c| C23 }} {{c| C24 }} }}
Where Template:box might contain:
<div style="{{{1|}}}">{{{2|}}}</div>
And Template:c might contain:
<div style="width:50px;height:50px;float:left">{{{1}}}</div>
Of course, you can set the sizes to whatever you like, this was just a convenient example.
Hope this helps!
-- Jim R. Wilson (jimbojw)
On 10/22/07, Giuseppe Briotti g.briotti@mclink.it wrote:
Hi all...
How is possible to create a template in order to show a dynamic html table? (i.e. a table with variable number of cols and rows )
e.g.
{{TableTemplate | nrow=3 | ncol=2 | C11 | C12 | C21 | C22 | C31 | C32 }}
<table> <tr><td>C11</td><td>C12</td></tr> <tr><td>C21</td><td>C22</td></tr> <tr><td>C31</td><td>C32</td></tr> </table>
{{TableTemplate | nrow=1 | ncol=2 | C11 | C12 }}
<table> <tr><td>C11</td><td>C12</td></tr> </table>
etc. etc.
I tried with LoopFunctions, but with no success... I think that the problem is related on how the parser manages the tags.
Thanks
Giuseppe
--
Giuseppe Briotti g.briotti@mclink.it
"Alme Sol, curru nitido diem qui promis et celas aliusque et idem nasceris, possis nihil urbe Roma visere maius." (Orazio)
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
mediawiki-l@lists.wikimedia.org