Home » Community » Newbie corner » Can I use Javascript frameworks with Skylark?
Re: Can I use Javascript frameworks with Skylark? [message #38457 is a reply to message #38455] |
Tue, 18 December 2012 15:43   |
|
Hi lectus,
I found at least 2 problems.
1) You call LoadFile('js/...') etc., but that fails to load anything, since it searches relative to the executable, which is most probably somewhere else then js folder. You should use the static/** handler from Skylark/static.icpp for this, it is much better (can even manage caching for you). To use it, you have to just use correct paths in you templates, e.g.:
<script src="/TestingJqueryUI/static/TestingJqueryUI/js/jquery-1.8.3.js"></script>
<script src="$CachedStatic("TestingJqueryUI/js/jquery-ui-1.9.2.custom.js")"></script> The second takes advantage of the caching, if it is configured.
2) There is a bug in the witz parsing, that causes "$$" to be interpreted as "" instead of "$", I'll send a fix to Mirek ASAP.
3) This is not really a problem, but you should now that your template uses link tags outside of head, which IIRC is not valid... But it works in most browsers
So the corrected template should look like this:
#include Skylark/Base
<link href="$CachedStatic("TestingJqueryUI/css/ui-lightness/jquery-ui-1.9.2.custom.css")" rel="stylesheet">
<script src="$CachedStatic("TestingJqueryUI/js/jquery-1.8.3.js")"></script>
<script src="$CachedStatic("TestingJqueryUI/js/jquery-ui-1.9.2.custom.js")"></script>
<script>
$$(function() {
$$( "#dialog" ).dialog();
});
</script>
<!-- I'm trying to run the example from: http://jqueryui.com/dialog/ -->
#define TITLE TestingJqueryUI application
#define BODY
<div id="dialog" title="Basic dialog">
<p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
</div>
To fix the parsing error before it gets into svn, just change Skylark/Compile.cpp around line 362 from this:
if(s[1] == '$')
s += 2;
else {
to this:
if(s[1] == '$') {
blk.AddText(b, s+1);
p.Set(s+2, NULL, line);
b = s = p.GetSpacePtr();
} else {
Hope this will finally solve it for you 
Honza
|
|
|
Goto Forum:
Current Time: Mon Jul 07 19:11:47 CEST 2025
Total time taken to generate the page: 0.03623 seconds
|