Re: [Maypole] Why is moniker used instead of of table name when looking for table specific templates?

From: Simon Flack (sf at flacks.net)
Date: Wed Dec 29 2004 - 01:16:32 GMT


Peter Speltz wrote:
>>>fom M::Manual::View--
>>> Locating Templates
>>> . . .
>>> . . . This is where the
>>> third directory comes in. The other directory, which May­
>>> pole checks very first of all, is specific to the table
>>> that you're viewing. So if you go to
>>> "http://your.shop.com/basket/list", Maypole will look in
>>> the basket directory first for a file called list, and
>>> second in the custom directory for a site-wide list tem­
>>> plate, and then fall-back to the factory directory for a
>>> generic list template.
>>>
>>>The example in its simplicity is misleading as under default class dbi a
>>
>>table
>>
>>>like "note_card" will have a moniker like "notecard" and thus the directory
>>>"notecard" will be searched.
>>
>>I'm not sure it's misleading, but it is ambiguous.
>>
>
>
> Misleading in this case:
> package Football;
> use base Class::DBI;
> Football->table('fairy');
>
> #Football->moniker is "football" which doesn't 'fairy'.
>
>
>>> I'm not sure why moniker was used instead of table name. HOwever moniker
>>
>>is
>>
>>>overrideable so if you decide to change it, you'd need to change names of
>>
>>your
>>
>>>template directories.
>>
>>If we document the fact that the view uses the model's moniker for
>>template paths then that would be expected behaviour.
>>
>>What are you overriding moniker() to? Or to put it another way, why is
>>your overriden moniker() unsuitable for a template path?
>>
>
>
> Not sure yet :). Ideally i'd want to override it for use in templates the same
> way column_names is used. So it could have any characters in it (especially
> spaces.)

If it's just for the templates, you could define description() in your
model class. It's used to populate the classmetadata.description
template variable.

--simonflk

_______________________________________________
maypole mailing list
maypole at lists.netthink.co.uk
http://lists.netthink.co.uk/listinfo/maypole



This archive was generated by hypermail 2.1.3 : Thu Feb 24 2005 - 22:25:57 GMT