On 2 Aug 2009, at 12:20, Christoph Pojer wrote:
You should use the first method, although I recommend against the use
of <?= because it is deprecated in PHP5.3 and will be removed in PHP6.

I usually do it like this:

<script type="text/javascript">
(function(){
 this.Config = <?php echo json_encode(array(...)); ?>
})();
</script>

which creates a global variable "Config".

Thanks: I see that for enough config variable to justify an array, a cookie would perhaps not be suitable. However, all I'm thinking of is a single ID-type variable. Why would a cookie not be good?

(Also thanks for the <= tip: I wasn't aware of that)

Michal.

Reply via email to