subcomponent and phased_vars

1 view
Skip to first unread message

shaman

unread,
Mar 4, 2009, 5:39:49 PM3/4/09
to erlyweb
Is it possible to pass some variable from subcomponent to main
component? E.g. component C is subcomponent of other subcomponent B,
and B is subcomponent of layout component A. How one can pass
something from C to component A? For example component C requires some
JavaScript in HEAD html-tag, and it would be reasonable to insert that
in layout component A (but only when C component is used). As I see,
{response, … phased_vars..} can’t help for subcomponents. Is it a bug
or a feature?

Yariv Sadan

unread,
Mar 6, 2009, 5:14:40 PM3/6/09
to erl...@googlegroups.com
Is sounds like phased_vars is exactly what you're looking for. Does it
not work for you?

shaman

unread,
Mar 7, 2009, 5:43:18 PM3/7/09
to erlyweb
Suppose controller "foo" return contains {response,
[{phased_vars, ..., {body, [{data, ...}, ...{ewc, bar,..}]}]} and pass
phased_vars to layout controller easily. But is it possible to pass
phased_vars from "bar" in this case? It seems that here "bar" can
return {data, ...} only. What tuple should return "bar" to pass
phased_vars upper?

shaman

unread,
Mar 13, 2009, 6:52:16 AM3/13/09
to erlyweb
May be I wrote unclear. I try to explain.
There are some nested components "Layout", then C1 component that use
private component C2, that use private C3, etc.
I can not see a natural way to pass something from C2, C3 and so on to
"Layout". Certainly one can use shared memory (ets,or global
variable).
Can phased_vars be used for that?

Buggaboo

unread,
Apr 1, 2009, 3:22:16 PM4/1/09
to erlyweb
I use the phased_var repeatedly in my blog project, you may borrow the
code and the technique in my erlywog project: http://code.google.com/p/erlywog/

I believe it's in a module called blog_util in my project.

Grep for blog_util and you'll find it somewhere.

shaman

unread,
Apr 4, 2009, 2:54:56 PM4/4/09
to erlyweb
Thanks for share.
Reply all
Reply to author
Forward
0 new messages