great call, luther. thank to you and ron for the help.

here was the solution:

1) have the main view code call a component i called "stepFunc"
2) have stepFunc then render the appropriate mini-view

[views]
** first, i defined a view for each step. so there's a folder at
default/views/step and it has files like step1.html, step2.html, etc.
**

[main view]
** the variable step contains something like 'step1' **
<div>
    {{=LOAD(c='default', f='stepFunc.load', args=[step], ajax=False,
ajax_trap=False)}}
</div>

[controller]
** there needs to be some error handling but this is the basic gist **
def stepFunc():
    step = None
    if request.args:
        step = request.args[0]
    response.view = 'step/' + step + '.html'
    return dict(step=step)

this solves the problem perfectly. the only downside is that the steps
don't have access to variable from the original view -- everything the
steps see must be passed by the stepFunc controller. so it functions
differently from an include in that way -- the only variable it
understands here is step.

matt

On Dec 28, 11:15 am, Luther Goh Lu Feng <elf...@yahoo.com> wrote:
> Try usinghttp://www.web2py.com/book/default/chapter/13#Components-and-Plugins
>
> I think it should be what you are looking for.
>
> On Dec 29, 3:05 am, ron_m <ron.mco...@gmail.com> wrote:
>
> > Its ugly but you must have a finite and small number of nextStep targets
>
> > {{if nextStep == 'step1':}}
> >   {{include 'step1.html'}}
> > {{elif nextStep == 'step2':}}
> >   {{include 'step2.html'}}
> > ......
> > will get you going but introduces a maintenance issue if you add a step
> > later that ou have to remember to come back to here and fix.
>
> > The problem is the include passes through the template generation and that
> > pulls that body of code inline during the template substitution phase before
> > any code executes. I don't think it is possible to have a variable inside
> > the include statement. I would like to be proven wrong. :-)
>
> > Ron
>
>

Reply via email to