lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Alex,

>      It's because it seems awkward for me to have to write
> three files
> to handle this situation: a driver, a page with the
> presentation and the
> library. I've thought that a page with the presentation stuff and a
> library with the code would suffice.

You lost me here, could you please send some example of your intended
generation? Something like the examples presented below could help me
understanding your sequence needs.

>      Maybe I'll just have to get used to the CGILua way, but
> I can't say
> I think it's better than the PHP way. Anyway thanks for your comments
> and helping with CGILua.

Concerning the "CGILua way", we may be talking about similar things, just
not being very clear about it.

I'd say that CGILua allows some flexibility on the generation of content.
You could for example use:

1) Lua Scripts using cgilua.put: URL -> page.lua -> results
That would be the "old CGI school", mixing logic and presentation.

2) Lua Pages using cgilua.put: URL -> page.lp -> results
The "old templating school", still mixing logic and presentation

3) Lua Pages with calls to a library: URL -> page.lp <-> lib.lua -> results
A simple way to separate business and presentation logic

4) Lua Scripts with calls to a library that uses Lua Pages as subtemplates:
URL -> page.lua <-> lib.lua <-> template.lp -> results
That would be the basics for a MVC implementation (aka "model 2"), allowing
further separation of presentation and business logic.

On the other hand, your concerns about template processing were a good hint
for us. We are trying to isolate more the HTML generation from the template
processing, so one could use the .lp parser to different things like
processing strings for XML, SQL or whatever.

Another incoming feature will be context-aware template processing. That
would allow you to do the parsing of a template with an specific Lua
context. More on this later, but that could lend to some very useful
subtemplating techniques.

Thanks for the feedback,

Andre