[Grok-dev] Re: View URLs?
Philipp von Weitershausen
philipp at weitershausen.de
Wed Jun 25 10:41:12 EDT 2008
Kenneth Miller wrote:
> So I've got a single app with an exra Grok.Container and
> Grok.Model. I've defined ONE index view that inherits from
> zope.Interface so that it's available to essentially any Model/Container
> and the app. The way this is setup allows me to use the index template
> to provide a consistent look and feel to my app, and particularly
> navigation.
That not really how we do consistent look and feel, though. I suggest
writing multiple dedicated views and using one PageTemplate macro for
the common look and feel.
Or am I missing something?
> The problem I'm currently having is that my template uses
> view.url('this') methods to access other views, which works fine, but
> only when you're viewing the base app. For example
>
> The format for below is as follows:
>
> Container/View
> Link -> Generated result.
>
> App/index
> MyPage1 -> app/mypage1
> App/Container/index
> MyPage1 -> app/container/mypage1 when this should be pointing
> to app/mypage1
>
> How should I handle this? There's no url methods attached to the App
> object.
view.url() has several signatures. One of them is
view.url(obj, view_name)
Using this syntax you should be able to say
view.url(grok.getSite(), 'mypage1')
> Should I rearrange the way I handle index's/templates?
Possibly ;)
More information about the Grok-dev
mailing list