[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mason
Subject:    [Mason] %init called too late ?
From:       "P. Fleury" <fleury () users ! sourceforge ! net>
Date:       2003-03-02 15:23:24
[Download RAW message or body]

Hi !

I have tried the following:

### in file /autohandler:

<%attr>
    title => 'DEFAULT VALUE'
</%attr>

<%method title><% $m->attr_if_exists('title') %></%method>

<title><& SELF::title &></title>


### in file /sample.html
<%args>
    $category
</%args>

<%method title>Details about <% $catname %></%method>

<%shared>
    my $catname = "SHARED VALUE";
</%shared>

<%init>
      $catname = "INIT VALUE";
</%init>


What I'd like to achieve is that a component can define a value as 
static by giving an attribute in %attr, defining dynamic information in 
defining the method 'title', and give the whole thing a sensible default 
value in case none of the previuos has been given.

In the case of these two files, if I call the /sample.html with a 
browser, the resulting title is 'SHARED_VALUE'. However, the arguments 
from <%args> (in my case needed to construct the value of the title) do 
not seem to be visible to the <%shared> block, and the <%init> block is 
executing too late to have the result displayed in the autohandler's 
call to the method title.

Did I miss something in the doc ? Is there a common way to solve this 
problem ?

thank you,
--Pascal



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic