plone - How to render a template page by calling its method from TAL portlet(@@manage-portlets) -


how call method in filesystem tal portlet (made available collective.portlet.tal)?

this how did it: defined new browserview (createpictmenu.py in case) , registered renderer new portlet component:

class addresstal(browserview)      def my_address()         address_bar = viewtemplatepagefile('templates/address_left.pt') #           page template want new portlet. 

and in configure.zcml:

<plone:portlet     name="collective.portlet.tal.talportlet"     interface="collective.portlet.tal.talportlet.italportlet"     assignment="collective.portlet.tal.talportlet.assignment"     view_permission="zope2.view"     edit_permission="cmf.manageportal"     renderer=".browser.createpictmenu.addresstal"     addview="collective.portlet.tal.talportlet.addform"     editview="collective.portlet.tal.talportlet.editform"     /> 

then went localhost:8080/myproject/@@manage-portlets , selected tal portlet option add portlet dropdown list. informed title address , description inserted snippet below call address_tal():

<span tal:define="global li view/myaddress">     <span tal:replace="structure li" />  </span>  

unfortunately, didn't work. please help.

you should have registered class addresstal browser:view directive, not plone:portlet one. this:

<configure     xmlns="http://namespaces.zope.org/zope"     xmlns:browser="http://namespaces.zope.org/browser">    <browser:page       name="address-view"       class=".browser.createpictmenu.addresstal"       for="*"       permission="zope2.view"       />  </configure> 

and call with:

<div tal:define="my_address python:context.restrictedtraverse('@@address-view').my_address()" >     method returns <span tal:content="my_address" /> </div> 

or:

<div tal:define="address_view context/@@address-view" >     method returns <span tal:content="address_view/my_address" /> </div> 

Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -