when I go on configure.zcml and put a new browser:page I set the
class=".src.views.file.MyClass"
Can I change the title of the page from inside the class? on init or call or something ?
when I go on configure.zcml and put a new browser:page I set the
class=".src.views.file.MyClass"
Can I change the title of the page from inside the class? on init or call or something ?
When I remember right, the title is presented by a viewlet (this may depend on the Plone version) -- you could use manage_viewlets
to check whether this is indeed the case. Viewlets adapt (among other things) the view. Thus, a specialized viewlet could obtain the title value from the view class.
If for example this is for a custom content type, you could consider overriding the viewlet for (just) that .
You will need to register it for something like
for="some.thing.Someclass"
see:
https://docs.plone.org/develop/plone/views/more_view_examples.html
If it is the page title you mean, the (viewlet) template could have something like:
<h1>${view/get_the_title}</h1>
if you define
det get_the_title:
return "something"
with "something" I ment other methods, since I was referencing the class associated with the view.
What you suggested will change the title for all pages.
I want to change the title only on this one page.
When you create a page using just the zcml as I explained, and go see in the browser, the title shown is "Plone site"
It will change the title for all pages that 'that is somewhat different' than others (like a custom content type).
If it is just for one page you could maybe put some logic in it ?
I think the viewlet that renders it is:
Which gets the title from:
Thanks, but it will not work for my case.
Since it's not possible from the class I will hack some js to do that.