View Full Version : Can't include files by selection
arina
11-12-2004, 04:14 AM
Hello!
Please help me to include files relatively:
(res==1 ? not_found.lzx : found_result.lzx) and default is empty_result.lzx.
Where is my mistake below?
<class name="l">
<attribute name="href" setter="setHref()"/>
<method name="setHref">
var w = LzBrowser.getInitArg('res');
var hr;
if(w == "1"){
hr="not_found_result.lzx";
}
else if(w == "2"){
hr="found_result.lzx";
}
else{hr="empty_result.lzx";
}
this.setAttribute("href",hr);
</method>
</class>
<l/>
or
<script>
var w = LzBrowser.getInitArg('res');
var hr;
Debug.write(res);
switch(w){
case "1":
hr='not_found_result.lzx';
break;
case "2":
hr='found_result.lzx';
break;
default:
hr='empty_result.lzx';
}
Debug.write(hr);
var url=new LzURL(hr);
</script>
<include href="${hr}"/>
Thank you!
antun
11-12-2004, 09:05 AM
I don't think you can dynamically include an LZX file. Remember that those constraints you're writing are being resolved at run-time, i.e. after the app is downloaded and has started ont he client.
The LZX reference page for <include> shows href as being an URL type tag attribute. The page that explains what the different types are is:
http://www.laszlosystems.com/lps-2.2/docs/reference/info-attribinfo.html#typetag
... but it doesn't mention URL. I've filed a bug on this.
-Antun
could you build the switch into say PHP code embedded in an HTML wrapper page to select the appropriate lzx page?
arina
11-15-2004, 12:32 AM
I don't think you can dynamically include an LZX file. Remember that those constraints you're writing are being resolved at run-time, i.e. after the app is downloaded and has started ont he client.
Hi, Antun!
Does it mean that a variable ${hr} is not recognizible at all at this 'run-time' moment?
But if i'd like to include dynamically texts or images and so on - wonn't this structure work also?
Ok, I'll try to manipulate with files in another way. And thanks for reply.
Arina
arina
11-15-2004, 12:41 AM
Originally posted by d~l
could you build the switch into say PHP code embedded in an HTML wrapper page to select the appropriate lzx page?
Hello, d~l!
If this is the only way to include files dynamically..
The question is remaining:
do you mean simple PHP-code file inclusion or this method:
<body>
<script type="...">
lzEmbed({url:'index.lzx?lzt=swf'});
</script>
</body>
When i put lzEmbed in an HTML code file - it work fine, but when i put it into an JSP code file - it doesn't handles. This make me think that in a PHP code it would be also not recognizible....
Arina
Thanks for reply
I had in mind the approach of building a case switch (in PHP) into your HTML wrapper page.
But if (like me) you are interested in dynamic graphing, driving SVG etc. .. then I wrote up a few experiments here
Laszlo & PHP (http://www.laszlosystems.com/developers/community/forums/showthread.php?s=&threadid=1321&highlight=PHP)
Instead of JSP I have adopted a phpservlet (http://tools.herberlin.de/phpservlet/index.shtml) which is written in java .. allowing PHP to run in CGI mode on Tomcat server.
The same principles apply as in using helloworld.jsp.lzx pre-processed requests.
i.e. call helloworld.php.lzx
But note the warning that this pre-processed request "idiom" may not be supported in future.
I find that php.lzx apps (i.e. with embedded php script) work well .. but of course the apps need to be recompiled each time there is a change.
With PHP you can also have remote server includes. See earlier thread on includes (http://www.laszlosystems.com/developers/community/forums/showthread.php?s=&threadid=1093&highlight=PHP)
antun
11-15-2004, 08:18 AM
But if i'd like to include dynamically texts or images and so on - wonn't this structure work also?
You can write a constraint in the form <view src="${...}" />, but the app will make the request for that image at run-time, not at compile-time. A laszlo application can make data and media requests at run-time.
-Antun
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.