[Helma-user] Deep Macro Invocation

Anton Pirker helma at gmiatlich.net
Tue Sep 25 09:03:02 CEST 2007


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


More information about the Helma-user mailing list