Re: Deep Macro Invocation
"VividVisions, Walter Krivanek" <[email protected]> Tue, 25 Sep 2007 09:22:41 +0200
| Newsgroups | gmane.comp.java.helma.general |
|---|---|
| Message-ID | <[email protected]> |
Hi Anton,
did you set getMacroHandler(name) on your HopObjects?
Quote from here http://dev.helma.org/wiki/New+Skin+Features+in+Helma
+1.6/#Deepmacros
The handler object path is resolved by calling method getMacroHandler
(name) successively on each handler path element. The method takes
the next path element as string and is supposed to return the next
path element, similar to getChildElement(name) for request path
resolution.
For untyped JavaScript objects, macro path resolution also works in
an autmatic way by following object properties. For prototyped
HopObjects, this mechanism is disabled because of security
considerations.
Bye,
Walter
Am 25.09.2007 um 09:03 schrieb Anton Pirker:
> hello all!
>
> i just tried to use deep macros the first time, and i must admit: i am
> too dump.
>
> i have a prototype Venue which has a object-relation to a object of
> the
> prototype City:
>
>
> ----
> Venue/type.properties:
>
> city = Object(City)
> city.local = city_id
> city.foreign = city_id
> ----
>
>
> Now i am in a skin of the Venue and want to call: <% this.city.name %>
> where "name" is a property of the City.
>
> ----
> City/type.properties:
>
> _db = shnitzl
> _table = cities
> _id = city_id
>
> _parent = venue.city, root.cities
>
> name = city_name
> zipcode = city_zipcode
> ----
>
>
>
> The result:
> [Unhandled Macro: this.city.name]
>
> So i wrote a field_macro(param, fieldName) in HopObject with the
> positional parameter "fieldName" if i try to call it with <%
> this.city.field "name" %> i get:
>
> [Unhandled Macro: this.city.field]
>
>
> hm. so i tried just to call <% this.city %> to see if this exists.
> I get:
> [object City]
>
> But why is there [object City] and not [HopObject City]? I did the
> object relational mapping as always. i am quite confused...
>
> when i write an macro in the Venue like this:
> ----
> Venue/macros.js:
>
> function cityName_macro(param) {
> return this.city.name;
> }
> ----
>
> and i call it with <% this.cityName %> everything works fine...
>
> so, how do i use deep macros? can i only call macros or also
> properties
> of objects? do i have to enable deep macros somewhere?
>
>
> questions over questions, but i think someone can answer them!
>
> thanks in advance,
> Anton
> _______________________________________________
> Helma-user mailing list
> [email protected]
> http://helma.org/mailman/listinfo/helma-user
>
_______________________________________________
Helma-user mailing list
[email protected]
http://helma.org/mailman/listinfo/helma-user
smime.p7s
(application/pkcs7-signature, 2.4 KB) - not displayed