[Helma-user] Deep Macro Invocation
VividVisions, Walter Krivanek
walter.krivanek at vividvisions.at
Tue Sep 25 09:22:41 CEST 2007
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
> Helma-user at helma.org
> http://helma.org/mailman/listinfo/helma-user
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2445 bytes
Desc: not available
Url : http://helma.org/pipermail/helma-user/attachments/20070925/c00464dd/attachment.bin
More information about the Helma-user
mailing list