This Helper is very useful to build the site when you pass the variable from php to javascript, we sometimes need to
pass and receive the data in site between client and server.
For This helper, there is view file (views/include/userjs.php)
In View
Add the below to view file
$Frontend->phptojs(); //default file path
$Frontend->phptojs('include/userjs');
Will be like this.
<script type="text/javascript">
var variable=value;
</script>
In Model
Load the helpr and pass the data to javascript, when you send the name ,pay attention to the prefix of name you can set
in helper.
$this->loadHelper("phptojs");
$this->Phptojs->passTojs("thule","wow");
$this->Phptojs->passTojs("thuleint",1);
Useful options to Buffer
There are several useful options to Buffer,below is a example.If you have a look the Phptojs class, you can catch.
$this->Phptojs->serializeToBuf("thule","wow");
$this->Phptojs->bufferFlush();