Hi Brian,

First I got the conclusion by reading the code. I do not know the reason why
the develop team do it in this way. It is quite confused when I start using
Turbine. I even do not know how to put in URL to access the first screen.

But according to the src code, WebMacroSitePage.java
---------------------------------------------------------------------------
        if (data.getScreen().equals("WebMacroSiteScreen"))
        {
            if ( data.getTemplateInfo().getScreenTemplate() == null )
                {
                    // template parameter is not set. Send to homepage.
                  data.getTemplateInfo()

setScreenTemplate( TurbineResources.getString("template.homepage","/index.wm
") );
                }
        }
---------------------------------------------------------------------------
it check whether you use WebMacroSiteScreen as the screen, if it is, read
from setting file and use template.hompage as the template.

---------------------------------------------------------------------------
       if ( data.getTemplateInfo().getScreenTemplate() == null )
        {
            // Ask the Screen for its Layout and then execute
            // the Layout. The Screen can override the getLayout()
            // method to re-define the Layout depending on data
            // passed in via the data.parameters object.
            String layout = ScreenLoader.getInstance()
                .getInstance(data.getScreen()).getLayout(data);
            // if the Layout has been set to be null, attempt
            // to execute the Screen that has been defined
            if ( layout != null )
            {
                LayoutLoader.getInstance().exec ( data, layout );
            }
            else
            {
                ScreenLoader.getInstance().exec ( data, data.getScreen() );
            }
        }

---------------------------------------------------------------------------

if no template is used, that means call the page by
.../Turbine/screen/abc. It will get layout from getLayout function, and
execute it.



---------------------------------------------------------------------------
        else


            // Get the layout template and the correct Screen.
            // Loads TemplateHolder with  matches.
            String template = data.getTemplateInfo().getScreenTemplate();
            TemplateHolder holder =
                WebMacroScreenLayoutLoader.getInstance().eval(template);

            String layout = holder.getLayoutName();
            String screen = holder.getScreenName();

            if (screen == null)
            {
                screen = "WebMacroSiteScreen";
            }

            data.setScreen(screen);

            // if the Layout has been set to be null, attempt
            // to execute the Screen that has been defined
            if ( layout != null )
            {
                data.getTemplateInfo().setLayoutTemplate(layout);

                LayoutLoader.getInstance().exec ( data,
"WebMacroSiteLayout" );
            }
            else
            {
                ScreenLoader.getInstance().exec ( data, data.getScreen() );
            }
        }
    }
---------------------------------------------------------------------
if all screen like   .../Turbine/template/abc.wm. The system will get screen
class and wm file by the template name. Also the system will try to find a
*.wm file for layout. Then in fact, they use WebMacroSiteLayout as the
template class.  This class will integrade the screen class, the screen
template, and the layout template together to form the final html page.



So call page using:  .../Turbine/template/abc.wm means you want use the
default screen class WebMacroSiteLayout.

If you want have more function other then WebMacroSiteLayout, you can write
one of your own. Then you can all the screen by:
.../Turbine/screen/abc



Again, I am a newbie myself. If I am wrong, please tell me and Brain. Do not
make Brain mis-leading by me.



Regards


fanyun







----- Original Message -----
From: <[EMAIL PROTECTED]>
To: "Turbine" <[EMAIL PROTECTED]>
Sent: Tuesday, August 01, 2000 6:53 PM
Subject: Re: How to change layout (If this mail is still
inamass,pleaseforgive me)


> Fanyun,
>
> I am learning, so I hope you don't mind if we discuss
> this a little further :-)
>
> >In turbine, you can call your screen in serveral ways
> >1.  file://local:8080/servlet/Turbine/screen/Test
> >this will call the test.java class, and use
> test.getLayout(Rundata data) function to determin the layout. But
> notice, here the layout is not the *.wm file. It is the layout
> class name. You have to write another layout class for it.
> >
>
> Excellent point! I did not notice that "getLayout" returned the
> name of the class.
>
> So, when using the "WebMacroSite" classes is
> it more convenient to specify the template in the URL. Then the
> template will determine the screen and the layout. I understand
> that WebMacroSite makes it convenient to convert a site of largely
> static content to Turbine.  But if I am starting new, should my
> URLs request templates (*.wm) or screens (and let the screen decide
> the template to return, ala MVC)?  I realize that the screen can
> always "short circuit" the template to be returned.  It seems like,
> if I use WebMacroSite*, the logic of my application is driven by
> templates, is this limiting?  Sorry, if I
> am making this to complicated!:-)
>
> Brian
>
>
>
>
>
>
> ------------------------------------------------------------
> To subscribe:        [EMAIL PROTECTED]
> To unsubscribe:      [EMAIL PROTECTED]
> Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
> Problems?:           [EMAIL PROTECTED]
>



------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to