469,292 Members | 1,500 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,292 developers. It's quick & easy.

template library

Lee
Hi, I have a template file that looks something like this

<tr>
<td>{var1}</td>
<td>{var2}</td>

<td>
<table>
<tr>
<td>Name: {name3}</td>
<td>Age: {age3}</td>
</tr>
</table>
</td>

</tr>

And I have a small javascript function that opens the template file
above, replaces the variables with values in a hash, and returns the
html in a string. Then, I put it into a table as a new row by just
adding it to the tbody string.
Works beautifully... in Firefox. In other browsers like IE 6, I think
I need to use functions like table.addrow() and table.addcell(). These
functions are compatible with other new browsers as far as I know and
so this would be what I want to use.

My question is, how would I do this if I want to start with the
template file? The reason I want a template like this is that I also
have server side scripts using it, and I figure it's the best way for
javascript and php to use a template from the same source.

I was thinking of parsing it using regex, finding each row and adding
it individually, but I am not sure what the regex would be to find each
individual row. And I am not sure if I can simply add a table without
a function similar to table.addrow().

Any help would be appreciated.

Nov 4 '06 #1
1 1129
Lee
Hi,
Has anyone thought of something for this? I really would like some
help..

Nov 9 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Michael Maes | last post: by
4 posts views Thread by Marcelo | last post: by
reply views Thread by Robbie Hatley | last post: by
1 post views Thread by Robbie Hatley | last post: by
19 posts views Thread by n.torrey.pines | last post: by
1 post views Thread by WebCM | last post: by
11 posts views Thread by Juha Nieminen | last post: by
6 posts views Thread by Gaijinco | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.