<tal:block
tal:define="our_url context/@@plone_context_state/canonical_object_url;
home_url context/@@plone_portal_state/portal_url;"
tal:condition="python:our_url == home_url">
HERE GOES YOUR STUFF
</tal:block>
The great thing about @@plone_context_state and @@plone_portal_state is that they handle all sorts of weird edge cases. context/@@plone_context_state/canonical_object_url also returns the right, most basic, object's url even when you're viewing the default page in the portal root with a query string appended :-)
how about something like <tal:condition="python: request.URLPATH0 == '/index_html' ...>`? see TALES Built-in Names and the Zope API Reference for more choices.
发布评论
评论(3)
最好的方法是使用两个非常方便的克隆视图,它们专门用于此目的。 定义它们的接口位于 https://svn.plone.org/svn/plone/plone.app.layout/trunk/plone/app/layout/globals/interfaces.py,以防您想查看。
@@plone_context_state 和 @@plone_portal_state 的伟大之处在于它们可以处理各种奇怪的边缘情况。 context/@@plone_context_state/canonical_object_url 也会返回正确的、最基本的对象 url,即使您正在查看门户根目录中附加了查询字符串的默认页面:-)
The best way is to use two really handy plone views that are intended just for this purpose. The interface that defines them is at https://svn.plone.org/svn/plone/plone.app.layout/trunk/plone/app/layout/globals/interfaces.py, in case you want to check it out.
The great thing about @@plone_context_state and @@plone_portal_state is that they handle all sorts of weird edge cases. context/@@plone_context_state/canonical_object_url also returns the right, most basic, object's url even when you're viewing the default page in the portal root with a query string appended :-)
我使用类似于 axe 的东西:
I use something similar to ax:
类似 ...>` 怎么样?请参阅 TALES 内置名称 和 Zope API 参考了解更多选择。
how about something like
<tal:condition="python: request.URLPATH0 == '/index_html'
...>`? see TALES Built-in Names and the Zope API Reference for more choices.