lua-users home
lua-l archive

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


Hi André,

Andre Carregal wrote:

Well, it depends on how you create "page.lp". If it does not generate any
HTML per se, you can decide on different output pages from your "lib.lua".
For example (untested):

Would that work for you?

This will probably do, yes. I think this is the way to go, if I encounter any problems I'll let you know. :-)

I assume that would be the "{section ...}" construct, right? To be sincere
they look a lot like a loop for me, but you can think in the following
Smarty excerpt

    Maybe I'm being picky here, but something like

{section name=count loop=$users}


is more declarative than something like

<% for user in users() do %>


which is more imperative. For me it doesn't matter, but the declarative syntax may be easier for non-programmer designers. And would be more MVC-ish, what if people decide to not implement it with iterators in the future? Anyway I am fine with the current syntax, I wasn't asking to change it, I was just trying to make a point.

This is the kind of things that we are studying for the new context-aware
templates. One could do something like

users = {{name="a", phone="123"}, {name="b", phone="456"}}
cgilua.includehtml("page.lp", {users = users})

and CGILua would create the "users()" iterator automagically. We still have
to iron out the details, but it's doable.

Seems to be good stuff, I'm looking forward to it. Keep up the good work.

Cheers,

-alex