Hi newLISPER,
a week ago I started my project "Dragonfly". Now there's something to show, so it needs his own topic.
Currently Dragonfly (version 0.06) includes the following features
- generating HTML tables from lists
- generate several HTML tags (e.g. image, script, rss)
- a sliding panel with debugging information
- a very simple page-controller
- some basic functions for form generation
You can download on Google Code
http://code.google.com/p/dragonfly-newlisp/
I'd like to hear comments, feedback, ideas - just feel free to do.
Cheers
Marc aka Hilti
It's cool!
Am I supposed to be picking up the css styles? I'm seeing the plain old Times on white background...
cormullion, feel free to do so.
I just added a twitter search function including the generation of some nice bubbles.
Here's a screenshot

(//%3C/s%3E%3CURL%20url=%22http://www.marchildmann.de/dragonfly_twitter.png%22%3Ehttp://www.marchildmann.de/dragonfly_twitter.png%3C/URL%3E%3Ce%3E)
Oh - rest in peace Michael Jackson!
Dragonfly 0.08 is updated on Google Code.
It is very interesting!
Thank you! I will check it as soon as possible (I think it contains a big potential!)
A note: carefully check the name of your framework, since Opera Browser has a debugger called "Dragonfly".
See here:
//http://www.opera.com/dragonfly/
You could have problems from Opera company... since because they are in a similar working area: web...
Quote from: "ale870"
A note: carefully check the name of your framework, since Opera Browser has a debugger called "Dragonfly".
See here:
//http://www.opera.com/dragonfly/
You could have problems from Opera company... since because they are in a similar working area: web...
Hi,
I think the name "Dragonfly web framework" shouldn't get me into trouble. because there are a lot of projects or companies which include the name "Dragonfly" like "Dragonfly BSD", "Dragonfly Webdesign", "Dragonfly CMS" ...
Are there any lawyers in this forum who may help?
Best Regards and I hope You like my project. Version 0.10 is coming soon!!
hilti
I love the speed of newLISP!!!
Check out this picture in my blog post:
http://dragonfly-newlisp.blogspot.com/2009/07/i-love-speed-of-newlisp.html
Yes I agrree with you, newList is very fast!
In fact I'm using it as scripting language for a new 2d game engine I'm creating!
unbalanced-parentheses is now running Dragonfly, although just serving up random posts from the archive at the moment. It's working, but only just!
Just one thing I had to change - weird, this one.
In web.lsp:
(define headers '(("Content-type" "text/html")))
didn't work. But:
(define headers '(("Content-Type" "text/html")))
did. Must be some FreeBSD thing...
Jeff and Hilti: thanks for your efforts!
Quote from: "hilti"
Quote from: "ale870"
A note: carefully check the name of your framework, since Opera Browser has a debugger called "Dragonfly".
See here:
//http://www.opera.com/dragonfly/
You could have problems from Opera company... since because they are in a similar working area: web...
I think the name "Dragonfly web framework" shouldn't get me into trouble. because there are a lot of projects or companies which include the name "Dragonfly" like "Dragonfly BSD", "Dragonfly Webdesign", "Dragonfly CMS" ...
Fans of a certain web site that would humorously respond to weekly emails might enjoy a slight name change to "Dagronfly" (I said consummate v's! Consummate! (//http))
WOW! So great to see it working on Your website.
hilti
Quote from: "m35"
Quote from: "hilti"
Quote from: "ale870"
A note: carefully check the name of your framework, since Opera Browser has a debugger called "Dragonfly".
See here:
//http://www.opera.com/dragonfly/
You could have problems from Opera company... since because they are in a similar working area: web...
I think the name "Dragonfly web framework" shouldn't get me into trouble. because there are a lot of projects or companies which include the name "Dragonfly" like "Dragonfly BSD", "Dragonfly Webdesign", "Dragonfly CMS" ...
Fans of a certain web site that would humorously respond to weekly emails might enjoy a slight name change to "Dagronfly" (I said consummate v's! Consummate! (//http))
Hello @m35, but are you referring to me when you say "Fans of a certain web site that would humorously respond to weekly emails" ?!
(See sbemail (//http))
Hilti - I'm looking at dragonfly v12 now!
If you made Dragonfly:listener able to accept single queries such as "www.example.com/?teststring", then could I use .htaccess mod_rewrite to redirect URIs of the form "www.example.com/teststring" to "www.example.com/?teststring"? Not quite sure about your 'action' yet...
Cheers!
Quote from: "cormullion"
If you made Dragonfly:listener able to accept single queries such as "www.example.com/?teststring", then could I use .htaccess mod_rewrite to redirect URIs of the form "www.example.com/teststring" to "www.example.com/?teststring"? Not quite sure about your 'action' yet...
Hi!
Using htaccess mod_rewrite should be possible, but I didn't test it, because I just use newLISP as a webserver at the moment.
The "action" idea is about simulating something like a REST Interface, because newLISP always returns the 200 status code in CGI mode. Maybe I'm not finding the right switch ...
An "action" can be something like
/customer/show/1
/customer/findall
/customer/delete/1
You know what I mean?
cheers
hilti
Quote
because newLISP always returns the 200 status code in CGI mode. Maybe I'm not finding the right switch ...
You can force a different status code and text using the "Status: ..." directive from the CGI specification. This is described here:
http://www.newlisp.org/downloads/CodePatterns.html#toc-22
in the sub chapter: "CGI processing in HTTP mode"
Quote from: "ale870"
Hello @m35, but are you referring to me when you say "Fans of a certain web site that would humorously respond to weekly emails" ?!
Ah no sorry ale870. I was making a (perhaps too obscure) reference to a bit of internet culture/humor. cormullion seems to have picked up on it and provided an informative link. :)
Quote from: "cormullion"
(See sbemail (//http))
Sorry m35 for my misunderstanding!
Just a short notice: Dragonfly version 0.17 is out!
Dragonfly 0.17 provides some cool functions for auto-loading modules and custom helpers. Just put them into the specified directories "helpers-active" or "modules-active" and Dragonfly loads them on startup.
This way the Dragonfly web framework keeps small and efficient. You just load what You need.
Download it now and have fun!
http://code.google.com/p/dragonfly-newlisp/downloads/list

(//%3C/s%3E%3CURL%20url=%22http://2.bp.blogspot.com/_CFrdlmy-B-I/SmrQGIPBE2I/AAAAAAAAAH0/Ece94VoTE74/s1600-h/Bild+3.png%22%3E%3CLINK_TEXT%20text=%22http://2.bp.blogspot.com/_CFrdlmy-B-I/S%20...%20Bild+3.png%22%3Ehttp://2.bp.blogspot.com/_CFrdlmy-B-I/SmrQGIPBE2I/AAAAAAAAAH0/Ece94VoTE74/s1600-h/Bild+3.png%3C/LINK_TEXT%3E%3C/URL%3E%3Ce%3E)
In these days I'm starting to work with Dojo framework, a language-independent AJAX client (one of the most famous). It is open source. See here:
http://www.dojotoolkit.org/
Since it is language independent, it means it can be used even from newLisp...
So I think you could start to introduce such framework (or another one) instead producing pure html.
Dojo works in xml and json (and newLisp can do that very well).
I think in this way to could give a BIG improvement to your framework (and a lot of work is done, since Dojo is stable and really well done!).
On itself those kits are nice like //http://qooxdoo.org/..
but a big disadvantgage I encountered is the speed and browser
compatibility...But they sure do have nice widgets ;-)
Try to use Dojo (check the demos). There is a delay on first usage (download javascript: about 130kb) but the system is really responsive.
Quote from: "ale870"
Try to use Dojo (check the demos). There is a delay on first usage (download javascript: about 130kb) but the system is really responsive.
Hi Alessandro,
the Dojo Toolkit is really impressive. Although I like fancy AJAX-Stuff, drag & drop and those things I'm a bit aware of these bloated libraries. They're like MS Excel or Word where users just utilize 10% of the whole software.
Think about what users really need: isn't it a fast loading website, an interface/design which runs on mobiles like the iPhone too, content which is accessible by search engine bots.
If You try to load 130kb via Edge on a Mobile ... users will quit before they read Your first headline. And making things worse: most of the cool JS-Stuff won't really work in a touch environment like the iPhone.
cheers
Marc
hi hilti - looks like really cool code you've released.
im curious to know why you chose the mit license instead of the license that newlisp uses, the gpl? any chance you might consider the gpl for future releases?
thanks in any case! - :0)
How about the two-clause BSD license?
just out of interest, what's the difference between the suggested licences?
Is BSD The New GPL? (//http)
Note: Zed Shaw is the former Ruby language programming guru, now Python language advocate... Zed does not mince words over his opinionated views on programming, and does not suffer fools (or Rubists ;) lightly... That said, he is usually right... And now prefering GPL over BSD for his new works... But most people nowdays, that don't want to suffer the pains of trying to figure out (let alone try to strictly follow), either license's rules, just throw up their hands and use the MIT license, as the least painful license for simple works they wish to share... Of course that p*sses the GPL's Richard Stallman off to no end ;p)
//http://en.wikipedia.org/wiki/BSD_licenses
//http://en.wikipedia.org/wiki/GNU_General_Public_License
//http://en.wikipedia.org/wiki/MIT_License
Quote from: "xytroxon"
But most people nowdays, that don't want to suffer the pains of trying to figure out (let alone try to strictly follow), either license's rules, just throw up their hands and use the MIT license, as the least painful license for simple works they wish to share...
That's why I use the MIT License.
What are the benefits when I use the GPL License for Dragonfly - are there any?
Quote from: "cormullion"
just out of interest, what's the difference between the suggested licences?
I think the modern two-clause BSD license is shortest and easiest to understand.
Here's an article, that for several possible advantages, such as for profit use, suggests the Apache License:
Does GPL still matter? (//http)
Quote
Jagielski claims that Apache's licensing terms are written to be comprehensible to people with no legal training. "It's very, very easy to read and understand, so it's a less risky license for external companies to use," he says.
//http://en.wikipedia.org/wiki/Apache_License
Quote
... as of July 2009, over 5000 non-ASF projects located at SourceForge.net are available under the terms of the Apache License.
Quote
The Apache Software Foundation and the Free Software Foundation (FSF) agree that the Apache License 2.0 is a free software licence, compatible with version 3 of the GNU General Public License (GPL).
However, the Free Software Foundation considers all versions of the Apache License (as of 2007) to be incompatible with the previous GPL versions 1 and 2.
-- xytroxon
... counting 37 downloads at Google Code :-)
I'm just wondering if anybody else uses Dragonfly for his projects? One project beside my own website is here: //http://daycaster.org
Cheers
Hilti (working on version 0.20)
i do! //http://unbalanced-parentheses.nfshost.com/
I think it's great. I've found Dragonfly easy to use and reliable. The only problem is that when a new version is released it's quite hard to work out which files to install, which to modify, and which to ignore. Perhaps that's a difficult architecture to design...
http://www.ohloh.net/p/dragonfly-newlisp
Quote from: "hilti"
... counting 37 downloads at Google Code :-)
I'm just wondering if anybody else uses Dragonfly for his projects? One project beside my own website is here: //http://daycaster.org
Cheers
Hilti (working on version 0.20)
Not yet, but I consider dragonfly (to try it out) for a PSI server.
Quote from: "Kirill"
Not yet, but I consider dragonfly (to try it out) for a PSI server.
Hi Kirill
what is a PSI server? Never heard of it.
Quote from: "Lutz"
http://www.ohloh.net/p/dragonfly-newlisp
That's just me, Lutz ;-)
Quote from: "hilti"
Hi Kirill
what is a PSI server? Never heard of it.
PSI stands for Public Subject Identifier (in the Topic Maps world that is). A PSI is an URI that servers two purposes: as a unique identifier for a subject and as a URL which can be entered into a browser to provide the end-user a description of what the subject refers to.
psi.ontopedia.net (//http) is a PSI server.
-- Kirill
Quote from: "joejoe"
hi hilti - looks like really cool code you've released.
im curious to know why you chose the mit license instead of the license that newlisp uses, the gpl? any chance you might consider the gpl for future releases?
thanks in any case! - :0)
i either misread or youve updated the license to gplv3 (like nL) !! :D
thanks for this, hilti! im downloading right now!
That's right. I've updated the license to GPL (v3), because I didn't see any difference (for my intention) between MIT License or GPL.
I just want the Dragonfly to be open source and free available.
Cheers!
Hilti
http://dragonfly.nfshost.com[/url]
The Dragonfly ajax functions in action:
//http://dragonfly.nfshost.com/dragonfly_ajax/index
Download it here
//http://code.google.com/p/dragonfly-newlisp/downloads/list
Have fun!
Hilti
Cool! Will upgrade soon...
the user guide really helped me get up and running in less than a minute. thanks!
Is your new version 0.50 available to non-Mercurial users yes?
(I gather Mercurial is another thing like git or subversion...?)
Quote from: "cormullion"
Is your new version 0.50 available to non-Mercurial users yes?
(I gather Mercurial is another thing like git or subversion...?)
It will be ready sometime this month, but there's still some work to be done before we make a release.
Mercurial is a DVCS like git (SVN is not a DVCS), it's pretty simple to use, just takes a little reading (//http) and then you'll get the hang of it.
Short instructions:
To grab a copy from the repo:
$ hg clone https://dragonfly-newlisp.googlecode.com/hg/ dragonfly-newlisp
To update your copy (I would do this once a day):
$ cd dragonfly-newlisp
$ hg pull -uf
If you're not committing code, that's really all you'll need to do anyway. :-)
To run the example-site, read the README and the INSTALL documents.
thanks... I managed to obtain a copy (thanks!)
I'm now trying to copy my content over to the new framework. It's not going too badly, but there are a lot of changes from the version I'm using!
Edit:
OK, I haven't figured it out yet. These are the kind of URIs I want to handle:
http://unbalanced-parentheses.nfshost.com/syntaxmatters
http://unbalanced-parentheses.nfshost.com/newlispatwikibooksvolunteerswanted
http://unbalanced-parentheses.nfshost.com/jack-the-glypher/ -> directory containing index.cgi
http://unbalanced-parentheses.nfshost.com/downloads -> directory
I used to test the selector:
(if (= "" Dragonfly:selector)
and provide a default page if I didn't find the string I wanted. What's the mechanism for doing this?
Hi Cormullion!
Just a short help to Your "downloads" problem: You could use a static route to it described on this page in the User Guide: //http://www.rundragonfly.com/dragonfly_routes
Put this into your view
<% (link_to "Downloads" "downloads") %>
About the selector:
I've to test some things out, but maybe you can create your own route described here
//http://www.rundragonfly.com/dragonfly_create_routes
Hope this helps!
Hilti
Thanks for the help! I'm not sure I really know what a route is.
In the last version, I had code in the 'view' that took action depending on the selector:
<div id="right">
<% (Dragonfly:load-database "blog.nldb") %>
<% (if (= "" Dragonfly:selector)
(set 'query (nldb:select-rows 'nldb:stories true true 'nldb:story-date >))
(set 'query (nldb:select-rows 'nldb:stories '(= nldb:story-id Dragonfly:selector)))) %>
<% (unless query (set 'query (nldb:select-rows 'nldb:stories '(= nldb:story-id "aboutthissite")))) %>
<% (set 'story (first query)) %>
<% (println {<h1>} (story 2) {</h1>}) %>
<% (println {<small>} (story 0) {</small>}) %>
<% (println (last story)) %>
</div>
Do I put this code in a .lsp file in 'plugins-active' (the static route you're talking about)? I would have thought it belonged in the view.
Forgive the stupid questions - I'm trying to catch you up but you're going too fast for me.:)
cormullion, I've updated the dragonfly_routes page with some more detail, read through it carefully, it should explain what they are and how they work. Also, take a look at the page on creating templates (also in the guide).
As of this post it's not up on rundragonfly.com, so view the example-site in your web browser locally using newlisp as the server (again, see the INSTALL and README files if you don't know how to do this). Before doing that though you'll need to pull the latest changes as I showed above first.
Quote from: "cormullion"
In the last version, I had code in the 'view' that took action depending on the selector:
<% (if (= "" Dragonfly:selector)
BTW, Dragonfly:selector has been removed. Views no longer have selectors or actions, if you want something like that either make a resource (see the guide on the RESTful route) or use GET/POST parameters with your views instead, or create your own route. If you need help, check the docs, they probably have the answer to your question, but if they don't let us know!
Thanks guys, Dragonfly is looking pretty impressive now. I've been reading the docs again. You've done a nice job.
Here's my problem. I already have the URLs I want (see above). I don't think I can use "RESTful routes" because the first value in these (the resource) has to be the name of the context whereas in my URLs I want it to be the name of the ID (the specific object in the collection). I don't want to create static routes because I don't want to create a page for each ID.
I suppose I'll have to use .htaccess to rewrite the incoming URL to insert a 'resource' identifier before the ID, and then use the 'action' to store the ID and pass it on to the .lsp resource. And then I can just go 'print' to output HTML? But then what happened to the template...
Quote from: "cormullion"
I don't want to create static routes because I don't want to create a page for each ID.
I looked at your URLs again (I hadn't really read your original post) and it seems like creating a page for each of those is the solution you're looking for, otherwise you're not really using Dragonfly to your advantage and end up rewriting a lot of the stuff that it handles efficiently and cleanly for you. You also end up with a massive single file that has a huge if/else block in it...
I'd consider splitting all of your pages into separate files the way the example-site does, but if you don't want to do that then just disable both of the default handlers in config.lsp and create your own route (as described in the guide). Your route would simply grab the first part of the request URL, set the DF:selector, and display your main file. Or you could even check the $GET parameters, i.e.: (if (nil? ($GET "downloads/foo")) ...)
Documentation on all of that ($GET, how to display files, etc.) is in the Core API (linking to my copy since rundragonfly.com currently isn't updated):
http://www.taoeffect.com/dragonfly-newlisp/example-site/dragonfly_api
Congratulations! Is this the official link to the Dragonfly docs?
http://www.taoeffect.com/dragonfly-newlisp/example-site/dragonfly_api
let me know when I can link to this (or other address) from the http://www.newlisp.org/modules/ page.
Quote from: "Lutz"
Congratulations! Is this the official link to the Dragonfly docs?
http://www.taoeffect.com/dragonfly-newlisp/example-site/dragonfly_api
That's just my personal testing ground for Dragonfly with Apache, the official link will be on the rundragonfly site once 0.50 is released:
//http://www.rundragonfly.com/dragonfly_api
That site isn't up-to-date as of this posting though.
Quote
let me know when I can link to this (or other address) from the http://www.newlisp.org/modules/ page.
Definitely! :-)
I think 0.50 should be around the corner very soon, the core I think is done and so is the User's Guide. Here's a link to the first page:
//http://www.taoeffect.com/dragonfly-newlisp/example-site/dragonfly_welcome
Quote from: "itistoday"
it seems like creating a page for each of those is the solution you're looking for [...]
... I'd consider splitting all of your pages into separate files
Each of those URLs is (when stripped of the domain name) the ID of an entry in a database. It made sense to me to have a single 'design' or template which was then applied to the information when extracted from the database. I'll have another look at the documents and work out how to do it the new way.
Quote from: "cormullion"
Each of those URLs is (when stripped of the domain name) the ID of an entry in a database. It made sense to me to have a single 'design' or template which was then applied to the information when extracted from the database. I'll have another look at the documents and work out how to do it the new way.
Ah! Gotcha, sorry, I didn't know that's what you were doing, and my sincere apologies if you mentioned it (I must have missed that part *whoops*).
In that case then a custom-route is the way to go, and yours should be extremely simple. For info on how to create a route (as well as an example) see this page:
//http://www.taoeffect.com/dragonfly-newlisp/example-site/dragonfly_create_routes
Or once it's updated, the official page:
//http://www.rundragonfly.com/dragonfly_create_routes
If you're not going to be using the other routes you can disable them, or place yours at the head of the 'dragonfly-routes' list so that it's evaluated first (for efficiency).
Quote from: "Lutz"
Congratulations! Is this the official link to the Dragonfly docs?
http://www.taoeffect.com/dragonfly-newlisp/example-site/dragonfly_api
let me know when I can link to this (or other address) from the http://www.newlisp.org/modules/ page.
The official Dragonfly docs are here now: //http://www.rundragonfly.com/dragonfly-api/index.html
Or in our site design: //http://www.rundragonfly.com/dragonfly_api
Cheers
Marc
... Dragonfly docs-index and site are now also accessible from here:
http://www.newlisp.org/modules/
and here:
http://www.newlisp.org/index.cgi?Code_Contributions
Not sure if the home page links for the authors Marc and Greg are correct on that last page.
Ps: The http://www.newlisp.org/code/modules/sqlite3.lsp.html module and help page has also been updated again.
I've nearly got my site working on Dragonfly 0.50. It's just me being slow - it's like waking up and finding that someone's moved all the furniture... :)
I can't quite work out one thing - how to make the forms work. For example, in the old version, I had this sort of thing for 'search':
<div class="form">
<form id="search" action="/search/for" method="POST" />
<p>
<input type="text" class="input" name="inputstring" size="8" value="" />
<input type="submit" name="search" value="Search">
</p>
</form>
</div>
where the "/search/for" got translated somehow, and the template called 'search' was loaded; the search string was obtained by
<% (set 'search-text (lookup "inputstring" Web:POST)) %>
My mind's now gone blank and I can't work out how to set this up in a completely different way.
I have many questions - but first i want to say "awesome job" for all this cool stuff!
Hi Cormullion!
Great to hear You're working with the new Dragon :)
The POST variables can be accessed like this for Your form.
<% (print ($POST "inputstring")) %>
Hope this helps!
Cheers
Hilti
Example with form:
<div class="form">
<form id="search" action="" method="POST" />
<p>
<input type="text" class="input" name="inputstring" size="8" value="" />
<input type="submit" name="search" value="Search">
</p>
</form>
</div>
<p>
<% (print ($POST "inputstring")) %>
</p>
I'm quite impressed the site! It's very clean and simple to navigate and understand. The Getting Started walk-though made sense and should make it easy for people to get started.
I've never done any serious web development, but if ever I did, Dragonfly would be a serious contender for my api. It has that very accessible bar of entry, just like newLISP does.
Quote from: "hilti"
Hope this helps!
Yes, thanks! That's nice and easy.
I'm now running Dragonfly 0.50 at //http://unbalanced-parentheses.nfshost.com/, and it's working quite well. There's a long list of things to do though.. :)
What's the best way to do Atom/Rss? I've got the code to provide the information, not sure about the routes...
How do you set the title of a page? Looks like the function call in header or something...
<title><% (title) %></title>
Also, I'm puzzled by how the question mark in the URL routes (eg "?welcome") disappears when I'm using Apache, but appears when using newLISP server. Why is that? It's making the search fall over but it works locally using newLISP server...
Anyway, thanks again to Team Dragonfly!
Quote from: "cormullion"
What's the best way to do Atom/Rss? I've got the code to provide the information, not sure about the routes...
If you're serving a static file for your feed then you can just add its extension to the STATIC_TRIGGER_EXTENSIONS in the config.lsp.
You're probably generating it on-the-fly though, so that's probably not what you want.
Instead just make a view (i.e. /feed) and place your newLISP code that outputs your Atom/RSS feed in it. Make sure to set the proper MIME-type though somewhere in there. I.e. place a call like this in your feed view somewhere:
(Response:content-type Response:xml-type)
Or provide your own string:
(Response:content-type "application/atom+xml")
In summary, this would be best done with a view + proper MIME type, there's no need to create a route for this (I don't think).
Quote
How do you set the title of a page? Looks like the function call in header or something...
<title><% (title) %></title>
That function is from the example-site, it's defined in plugins-active/dragonfly_basic.lsp and uses the symbol DF:viewname (which is set by the STATIC_TRANSFORMATIONS in config.lsp).
Quote
Also, I'm puzzled by how the question mark in the URL routes (eg "?welcome") disappears when I'm using Apache, but appears when using newLISP server. Why is that? It's making the search fall over but it works locally using newLISP server...
newLISP doesn't support the .htaccess redirection that apache does (see the explanation in the Getting Started part of the User Guide), and Dragonfly uses the QUERY_STRING to determine which view/resource is being accessed.
However, I've just added functionality to the mercurial repository that removes the need for the ? even when using the built-in newLISP server.
For more information, see the comments in this thread: //http://newlispfanclub.alh.net/forum/viewtopic.php?f=2&t=3168
BTW, when 0.51 is released (or if you're using the latest mercurial), use the newlispServer script to run the newlisp server (as it's no longer as simple as it was). Like this:
$ cd path/to/example-site
$ ./newlispServer
Wow, great tech support too! Thanks. I'll try to get this all working today...
By the way, when you update the framework, you won't overwrite all my changes in "plugins-active" will you? :)
Quote from: "cormullion"
By the way, when you update the framework, you won't overwrite all my changes in "plugins-active" will you? :)
Nope. As long as you're not modifying the files that come with Dragonfly and are creating your own plugins your changes won't be overwritten and no conflicts should arise.
Got most things working OK. One exception: an Atom feed. I'm struggling to make any progress with this - ran out of time for now - but hope to address the problem soon.
As I see it, this is the process that ought to work:
1 user request is for 'atom' - http://blah.com/atom
2 dragonfly converts this to a request to display the view file 'atom.html' in views/ ('html'? - well, your RSS file is 'dragonfly_rssfeed.html' in 'views/'.)
3 the 'atom.html' file generates the XML output:
<% (Response:content-type "application/atom+xml") %>
<% (Dragonfly:display-partial "head") %>
code to generate XML using partial templates
<% (Dragonfly:display-partial "story") %>
<% (Dragonfly:display-partial "foot") %>
where the partial files are called head.xml story.xml and foot.xml. (Or should they be 'html'?)
5 the header for the main web page refers to the XML feed using this function:
(rss "Dragonfly web framework RSS Feed" (web-root "?dragonfly_rssfeed/xml"))
or does there need to be an 'atom' version of this?
Anyway, apart from this one area I've yet to get to grips with, things are looking good!
I found a strange bug relating to the nldb database code... I'm using a revised version of nldb.lsp in plugins-active, but don't know whether you want to add it - or let me add it someday...
Quote from: "cormullion"
2 dragonfly converts this to a request to display the view file 'atom.html' in views/ ('html'? - well, your RSS file is 'dragonfly_rssfeed.html' in 'views/'.)
.html if the VIEW_EXTENSION is .html.
Quote
3 the 'atom.html' file generates the XML output:
<% (Response:content-type "application/atom+xml") %>
<% (Dragonfly:display-partial "head") %>
code to generate XML using partial templates
<% (Dragonfly:display-partial "story") %>
<% (Dragonfly:display-partial "foot") %>
Not really, I'm not sure why you're outputting the head/story/footer as you're not displaying an HTML document but an RSS/Atom feed.
Quote
where the partial files are called head.xml story.xml and foot.xml. (Or should they be 'html'?)
Check the docs (//http) for VIEW_EXTENSION. It's also documented via comments in config.lsp.
If VIEW_EXTENSION is .html, they should be .html if you're using the display-partial/display-view functions. Use display-file/include if you want to avoid the use of VIEW_EXTENSION. See the Dragonfly API for details.
Quote
5 the header for the main web page refers to the XML feed using this function:
(rss "Dragonfly web framework RSS Feed" (web-root "?dragonfly_rssfeed/xml"))
Hmm... that's actually outdated (from pre-0.50), I'll fix that. 'web-root' should not have the ? specified in the string and there's no need for the "/xml" after "dragonfly_rssfeed".
Quote
or does there need to be an 'atom' version of this?
If you want to display an atom feed include the appropriate markup to display atom feeds. I personally don't recommend relying too heavily on Dragonfly's markup-shortcut functions like 'rss', it's just as easy to include the actual HTML markup (check what 'rss' does, it's defined in dragonfly_basic.lsp, it's just a shortcut for the the 'link' tag to include an rss file in the page). If you're confused, check with google (//http).
OK, gotcha. I've probably been assuming that I should switch to '.xml' extensions at some stage but sticking with 'html' all the way helps - at least, hitting //http://unbalanced-parentheses.nfshost.com/atom seems to want to produce Atom XML.
The head/story/footer stuff is just so that I can output the XML heading stuff (author update etc) and then loop through each of the last x items.
Thanks again for the help!
I have one more problem... I'm finding that some pages are being processed through Dragonfly but I didn't think they were going to be (they're not views). For example, if you go to //http://unbalanced-parentheses.nfshost.com/downloads/mycroft.nl.html - it's a page generated by newlispdoc - and click on source, the resulting HTML file is being passed through Dragonfly:eval-template. Unfortunately that file contains text (probably multiple [text][/text] pairs) that causes eval-template to fail. It's not supposed to be a template.
ERR: missing parenthesis : "..."'(){}.0123456789[/text])
called from user defined function Dragonfly:eval-template
called from user defined function Route.Static:run
called from user defined function Dragonfly:listener
called from user defined function run
I thought that files came through 'as they were' if they didn't match anything else. I'm wondering whether I've done something that makes Dragonfly try to evaluate all files...
cormullion, please take a look at how Route.Static works:
//http://www.rundragonfly.com/dragonfly_routes
It will match all files that end in VIEW_EXTENSION, and your source page does as well. Therefore if there are any "code islands" (i.e. stuff that comes after OPEN_TAG: <%) then that will be interpreted as newLISP code and it will be evaluated.
If you don't want that file getting sent through eval-template then there are several things you can do:
- Update your .htaccess file with a RewriteCond to prevent files ending in .src.html from being sent to the index.cgi script. This requires knowledge of .htaccess files (search google for mod_rewrite).
- Do it instead through a custom route that checks if the QUERY_STRING represents one of your source files and then simply pass it through the 'display-file' function. Make sure this route is added to the front of 'DF:dragonfly-routes' so that it gets evaluated before Route.Static.
- Change your VIEW_EXTENSION to something else (and change all your template files as well to that other extension).
In a future version of Dragonfly we could probably add a hook to Route.Static that will allow you to define a function that determines whether the file should be passed through display-view or display-file (as the former sends it through eval-template and the latter doesn't), but for now your easiest solution is to add a custom route, which isn't difficult to do (again, the docs really help you here).
EDIT] Whoops, that's DF:include, not DF:display-file. DF:display-view calls DF:display-file which calls DF:eval-template. Apparently I don't know what my own code does. :-p
OK, thanks! I can solve it by passing it to DF:include... I didn't fully appreciate the fact that every matching file, not just a view file, is passed through eval-template. Makes sense now, though.
I have to admit that I've studied the documents, but still find it hard to solve problems - I'm not a web developer, so I don't have the basics down yet.
Quote from: "cormullion"
OK, thanks! I can solve it by passing it to DF:include... I didn't fully appreciate the fact that every matching file, not just a view file, is passed through eval-template. Makes sense now, though.
Ack! Sorry for giving you bad information, I've edited my post to mention that DF:include is what you want, not DF:display-file. You figured it out though. :-)
Quote
I have to admit that I've studied the documents, but still find it hard to solve problems - I'm not a web developer, so I don't have the basics down yet.
Just takes practice, you'll get it. :-)
BTW, I *love* your magical rainbow code highlighter stuff.
Quote from: "itistoday"
BTW, I *love* your magical rainbow code highlighter stuff.
:) I'm still trying to decide whether it's just cool or useful as well!
I realized I haven't uploaded the code for that; it's now uploaded as Module Nestor.
Quote from: "hilti"
* changed license from MIT to GNU (GPL v3)
Hi, just noticed the ohloh.net Dragonfly listing still has the old license.
http://www.ohloh.net/p/dragonfly-newlisp
Just wanted to let hilti know so he could update it there when he has a chance.
thanks!
Changed! :-)
Thanks JoeJoe!
Hilti
super duper! :D