Server side JavaScript rendering
<p>I have almost a 'best-practice' question that's been nagging at me for a while.</p>

<p>When I use JavaScript libraries and APIs such as JQGrid or Google Maps, I tend to find myself creating server side libraries to render the JavaScript for me.</p>

<p>For example I might have:</p>

<pre><code>$map-&gt;setZoom(10);
$map-&gt;setDimensions(200,250);
</code></pre>

<p>in PHP, which would internally render the relevant JS when I call <code>$map-&gt;render();</code>, for example.</p>

<p>This means I can easily generate JavaScript based on the state of my applications. I also find it easier to work with the data I already have in my controllers etc.</p>

<p>Is this a suitable way of using common functionality within a JavaScript library or would it be better to write JS as standard?</p>
