Javascript & Flexy

Posted by m6w6 on 2nd August 2004 in Mike's sudden inspirations: PHP

If you ever used Flexy, which I consider a really great TE, you have most probably already stumbled across Flexy’s inability to step into <script> blocks.

A really easy method to overcome this problem is to define scriptOpen and scriptClose properties in your base objects outputted by Flexy:

class FlexyObject {
  var $scriptOpen = "\n<script type="text/javascript"> <!--\n";
  var $scriptClose = "\n//--> </script>n";
  var $scriptData = "var foo = 'bar';";

Outputting above object with the following template wont work:

<script type="text/javascript">



…works like a charm… ;)

Alan said, Flexy wont step into Javascript blocks because that caused massive problems with the Smarty convertor…