[EMAIL PROTECTED] writes:

> Author: deryck
> Date: 2006-02-09 19:37:58 +0000 (Thu, 09 Feb 2006)
> New Revision: 13414
>
> WebSVN: 
> http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=13414
>
> Log:
> A compltetly broken commit...
>
> but I need someone who knows ejs to help me here.
> Tridge or Tim (or anyone :-), please look at 
> simple_table() in /swat/ejs/common.ejs.  I want to 
> return the table as a string, not using write().
> I've coded this up how it would work in JavaScript.
> This doesn't work with ejs, nor does += seem to work.
>
> Can someone point me to a work around or else code
> up the string handling in ejs to work properly.

Hi Deryck, try this:

function table_element(i, o, t) {
        t = t + "<tr><td>" + i + "</td><td>";
        if (typeof(o[i]) == "object") {
                var j, first;
                first = true;
                for (j in o[i]) {
                        if (first == false) {
                                t = t + "<br />";
                        }
                        t = t + o[i][j];
                        first = false;
                }
        } else {
                t = t + o[i];
        }
        t = t + "</td></tr>\n";

        return t;
 }

It looks like in each case, you were generating an expression and just not
providing anyplace to put it; i.e. you're not assigning it to a variable.

Derrell

Reply via email to