How to make footer to show items from main menu automatically in Plone?

别说谁变了你拦得住时间么 提交于 2019-12-22 08:17:27

问题


I am using Plone 4.1.4 with Doormat and Diazo in an institute I work and the Footer has to be made manually by adding each column and item that links internally to items from main menu.

What I want is that this footer, which is the site map, to change automatically every-time some user create, edite or delete an item from the main menu (content folders).

When I got the job I noticed many of those links in footer are out of date, and as there are many users in their each sections of the institute that are allowed to change the structure, I know they won't update both folders and footer.

I searched the Internet for some product or tip but I cant' find anything that resolves that problem.


回答1:


If your Diazo theme was created as a Python package using mr.bob or zopeskel, you probably already have z3c.jbot, which allows you to easily override templates, available. If so, you likely have a template_overrides or similar directory in the package. If so, just drop into it a file named plone.app.layout.viewlets.footer.pt with the contents:

<div i18n:domain="plone"
 id="portal-footer">

<ul id="portal-doormat"
    class="navTreeLevel0 visualNoMarker">
    <tal:sitemap replace="structure context/@@sitemap/createSiteMap" />
</ul>

</div>

Then style away!

Alternatively, you may replace the colophon by naming the file plone.app.layout.viewlets.colophon.pt.

If you aren't using a Python package for your theme (if the Diazo theme was created through-the-web) then you may use the portal_view_customizations tool in the ZMI to make the same template override.

You may wish to also customize the depth of the site map. That may be changed via the portal_properties tool, navtree_properties property sheet. Or, just use CSS to hide unwanted depth.




回答2:


An alternative and much easier way to realize your demand, can be to use portlets instead of viewlets, in combination with the addons "Products.ContentWellPortlets" and "collective.portlet.sitemap":

1.) Hide the footer-viewlets via a GenericSetup-config like in this example:

http://svn.plone.org/svn/collective/adi.simplestructure/trunk/adi/simplestructure/profiles/default/viewlets.xml

2.) Assign a sitemap-portlet in the footer-area via a GenericSetup-config, similar to this example:

http://svn.plone.org/svn/collective/adi.simplestructure/trunk/adi/simplestructure/profiles/default/portlets.xml

Tip: First assign the sitemap-portlet via the Web-UI, then go to [SITE-URL]/portal_setup, search for "portlets", check its box and click the export-button on the bottom, to get the needed xml-file.



来源:https://stackoverflow.com/questions/37163468/how-to-make-footer-to-show-items-from-main-menu-automatically-in-plone

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!