3

I want to change my website's header only it if's not the homepage. Is there a tal:condition expression for that?

I've been reading this and can't find what I'm looking for...

thanks!

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
bchhun
  • 18,116
  • 8
  • 28
  • 31

3 Answers3

6

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.

<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 :-)

Reinout van Rees
  • 13,486
  • 2
  • 36
  • 68
1

I use something similar to ax:

<tal:block define="global currentUrl request/getURL" condition="python: u'home' not in str(currentUrl)">

<!-- whatever -->

</tal:block>
Jon Hadley
  • 5,196
  • 8
  • 41
  • 65
0

how about something like <tal:condition="python: request.URLPATH0 == '/index_html' ...>`? see TALES Built-in Names and the Zope API Reference for more choices.

ax.
  • 58,560
  • 8
  • 81
  • 72