template tal - TAL Condition in Plone to hide HTML if it's a Document (Page) -


i'm trying modify /portal_view_customizations/zope.interface.interface-plone.belowcontenttitle.documentbyline template tal expression, document's author , modification date not show if current portal type document (page). don't mind if shows news items, time sensitive, not documents/pages.

this failing plone tal expression:

<div class="documentbyline"      id="plone-document-byline"      i18n:domain="plone"      tal:condition="view/show , not:python:here.portal_type == 'document'">  ... 

i've tried:

<div class="documentbyline"      id="plone-document-byline"      i18n:domain="plone"      tal:condition="view/show , not:context/portal_type='document'"> 

but still no luck. tracebacks pretty cryptic , don't relate tal expression. however, if rid of condition portal_type, works again. thoughts appreciated. manual good, i've looked @ official ones, , don't mention this.

tal's underlying tales, expression-engine of tal makes use of, doesn't support mixing of expression-types in 1 expression. it's syntax allows 1 expression-type specified (defaults 'path', if omitted, btw), no delimiter provided (like semicolon chaining several tal-statements in 1 element, e.g.).

but instead of mixing 3 expression-types can use 1 python-expression, try:

python: view.show , context.portal_type()!='document'

update:

if have customized plone's default-template via portal_view_customizations ('ttw'), restricted python-methods cannot accessed, that' why view/show throws error.

it returns allowanonymousviewabout-property of site-properties, can check condition , expression looks like:

tal:define="name user/getusername"  tal:condition="python:test(name!='anonymous user') , context.portal_type()!='document'; 

quick'n'dirty alternative:

do css:

body.userrole-anonymous .documentbyline {display:none} body:not(.template-document_view) .documentbyline {display:block} 

this render hidden elements, it's helpful prototyping , such, or 'quickfixes' (no admin available, etc.).


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -