PDA

View Full Version : Use Variables from PHP in laszlo canvas


javatis
09-09-2005, 06:12 PM
hi is there a way to get variables from php working in the Canvas, like its possible to combine php and JS or html?

Greetz Sascha

jstretch
09-12-2005, 12:19 PM
You can pass variables directly to the embed tag in the html:

<embed .... src="..../someApp.lzx?someVariable=<? echo $someVariable; ?>&....">

This variable will be available at the root level (canvas).

Here's a test I did using the javascript embed function they use, notice the test variable:

<script type="text/javascript">
lzEmbed({url: 'test.lzx?test=asdfasd&lzt=swf&Laszlo.property.live=false&lzr=swf7', bgcolor: '#ffffff', width: '500', height: '400'});
</script>


Here's the lzx:

<?xml version="1.0" encoding="UTF-8" ?>
<canvas debug="true" proxied="false">
<script>
Debug.write("test");
Debug.write(test);
</script>
</canvas>



PHP can also accept variables and format its response xml, which your lzx can use as a dataset. Here's a script snippet in laszlo that changes the dataset 'search' source and passes the variable countyidselected.

search.setSrc("registration_xml.php?countyidselected="+this.value);
search.doRequest();

javatis
09-12-2005, 01:17 PM
are there also other ways to comunicate for OL with PHP?

well for example... if i would like to build a chat taht relays on php as a part of the backend...

do i need to detup an TimeOut or Intervall and if.. give me a hint how to.

as far as i read untill know the only similar to a socket OL has is the <conection> tag but that only is to conect to the server and if i read right Laszlo systems means it has small capacity...

and with my questions i thought more of... uhm for annother example


in html / js / php envoirement its sometimes usefulle to do it thatway...

(OL)-><text> you have email from : (/OL). (<?php) MyVar.(/php>)

would be nice if u can give me some hints where to find possible ways of communication between php/flash/java/jsp/asp.... to openlaszle

especially php and the comunication from a flash swf to the laszlo interests me..

just a few tags to know where to read thx

Greetz Sascha