I've to use loads of textin javascript as templates. Its too bad (I know).
However, when I fetch the results through Ajax/PHP/JSON, it was elegant but made the fetching of results a little slow. I was displaying the matter in a popup.
So again I'm back to templates.
My question is:
"Is there any tool that can automatically parse the HTML code into javascript".
Example:
In HTML, the following code
<ul class="tabs">
<li><a href="#" name="#tab1">Introduction</a></li>
<li><a href="#" name="#tab2">Round</a></li>
<li><a href="#" name="#tab3">Rules</a></li>
</ul>
becomes in javascript as:
'<ul class="tabs">'+
'<li><a href="#" name="#tab1">Introduction</a></li>'+
'<li><a href="#" name="#tab2">Round</a></li>'+
'<li><a href="#" name="#tab3">Rules</a></li>'+
'</ul>'+
Are there any other ways?
<code>elements. Presumably this is so they don't have to include the HTML as a string inside their scripts, nor do they need to request it from the server.divcontent through jQuery/javascript?<script>tags? If you can't precompile your templates (really the optimal thing, I think), then<script>tags with a non-JavaScript "type" are fine.