roxen.lists.roxen.general

Subject Author Date
MVC separation? <gnudiff <> 12-01-2006
Hello.

I was wondering if you could provide some consultation on how to best
achieve the following with Roxen.

- I would like to have a better MVC separation that is usually
associated with RXML by itself.
Basically, I would like to make the Controller (and apparently Model)
part of the webapp in Pike, and leave RXML for View as it really
shines there.

To that effect I was thinking of using the Pike script module, and
whatever else is needed.
I was thinking also about maybe writing a small Roxen module, but that
remains the question - would that be an optimal way to do it?

What I would want to achieve should look something like this:

any Controller page

- processes form variables and takes appropriate actions etc.
- collects data and all the needed stuff for View
- passes info to the correct View

I was thinking of something like:

MyPage.pike
----------------------
string parse(object id)
{
        id->misc["MYAPP"]= ([ "myvar1": "mydata" ]);
        return  Roxen.parse_rxml("<insert file="MyPageView.rxml' />.",id);
}

Questions.
1) Is there a way to create my own scope so that I could reference the
myvar1 in RXML simply as &myapp.myvar1; ?

2) Is there a function for parse which would allow to parse the file
simply like Roxen.return_parsed_rxml("MyPageView.rxml",id) without
going with the (in this case) ugly "<insert file />"?

3) Is there a way - either from a Roxen module or elsehow, to make
certain variables always available to all such Pike scripts without
having to specify an #include file.

Like maybe making a Roxen module which defines
MYAPP_LIBDIR=/absolute/path/to/dir/  and then being able to reference
MYAPP_LIBDIR in Pike script just by the name?

4) Is this even the way to go about it? Any better suggestions?

TIA,
Emils