Sharing data between component is always tricky.

Here's how I would solve your specific title problem:

In your autohandler:
<head>
<title><& SELF:title &></title>
</head>
...
<%method title>A generic title</%method>

In your dhander:

<%shared>
 my $title = your title computation code
</%shared>
<%method title><% $title %></%method>


This is the simplest way in my opinion, but they're certainly other
solutions, for instance using $r->pnotes() (a hash during the scope of
the request) and playing with the order of execution of the mason
code.

I hope it helps.

Cheers.

J.



2009/10/14 Jackie Hamilton <tsor...@gmail.com>:
> Is there a way to pass a variable from the dhandler up to the autohandler?
>
> I'm building a site where the autohandler constructs the html page
> (including the page title) but the dhandler is the one that actually figures
> out what the page content and title is supposed to be. I can't figure out
> how to pass the $title info over. I've tried a shared section in the
> dhandler:
>
> <%shared>
> our $subpageTitle;
> </%shared>
>
> And $subpageTitle gets set in the %init block of the dhandler.
>
> However I can't seem to access $subpageTitle in the autohandler... I just
> get an error about "Global symbol "$subpageTitle" requires explicit package
> name". Not sure what package name to give it for the dhandler....
>
> Thanks!
>
> -kira
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Mason-users mailing list
> Mason-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mason-users
>
>



-- 
Jerome Eteve.
http://www.eteve.net
jer...@eteve.net

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to