Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/fortran/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Plone 什么';这是将globalnav移动到页脚的最直接的方法,仅在首页上_Plone - Fatal编程技术网

Plone 什么';这是将globalnav移动到页脚的最直接的方法,仅在首页上

Plone 什么';这是将globalnav移动到页脚的最直接的方法,仅在首页上,plone,Plone,我通过以下方式隐藏了正常Plone头版的各种元素: .section-front-page #portal-globalnav { display: none; } 现在,我想在靠近页脚的底部添加一个globalnav。我考虑过多种方法: 通过“显示”菜单选择的浏览器视图/模板 另一个viewlet Javascript(好吧,我没有考虑过这一点,因为我对Javascript不太了解,但这似乎是可能的。) 什么是最好的方法?头版唯一的问题是棘手的部分。您可以使用您的GS配置文件使用

我通过以下方式隐藏了正常Plone头版的各种元素:

.section-front-page #portal-globalnav {
    display: none;
}
现在,我想在靠近页脚的底部添加一个globalnav。我考虑过多种方法:

  • 通过“显示”菜单选择的浏览器视图/模板
  • 另一个viewlet
  • Javascript(好吧,我没有考虑过这一点,因为我对Javascript不太了解,但这似乎是可能的。)

什么是最好的方法?

头版唯一的问题是棘手的部分。您可以使用您的GS配置文件使用一个特殊的一次性界面标记首页,然后使用ZCML为该上下文和仅该上下文的
IPortalFooter
管理器注册
plone.global_节
viewlet:

<browser:viewlet
    name="plone.global_sections"
    for="my.special.IFrontPage"
    manager="plone.app.layout.viewlets.interfaces.IPortalFooter"
    class="plone.app.layout.viewlets.common.GlobalSectionsViewlet"
    permission="zope2.View"
    />

在Plone 4及更高版本中,您可以将globalnav viewlet注册为内容提供商:

<adapter
    name="globalnav"
    for="*
         zope.publisher.interfaces.browser.IDefaultBrowserLayer
         *"
    factory="plone.app.layout.viewlets.common.GlobalSectionsViewlet"
    provides="zope.contentprovider.interfaces.IContentProvider"
    />

然后使用以下方法将其包含在主页模板或主模板中:

<tal:block tal:replace="structure provider:globalnav"/>

我喜欢这两个建议,但最后我做了以下几点(因为我看不出如何用其他建议做我想做的一切):

和footer2.pt,如下所示(除了CSS id外,一切都一样):

当然,还有footer2默认页脚样式的副本:

#footer2 {
    clear: both;
    font-size: 80%;
    background: #ddd;
    /* ensure top navigation dont touches portlets, content etc.. #10491 */
    margin: 0 0 1em 0;
    text-align: center;
}
#footer2 li {
}
#footer2 li a {
    display: inline-block;
    padding: 0.5em 1em 2em 1em;
    background: #ddd;
    min-width: 6em;
    white-space: normal;
    /*TODO: Once we have removed the whitespace from the nav template, this can be put back*/
    /*border-bottom: 0.1em solid White;*/
    border-right: 0.1em solid white;
}

#footer2 .selected a,
#footer2 a:hover {
    background: #205c90;
    color: White;
}
#footer2 .selected a:hover {
    background: #ddd;
    color: #205c90;
}

通过不使用viewlets,而是使用portlet,有一种非常省时且非侵入性的方法

Products.ContentWellPortlet允许您将Portlet放置在内容的上方和下方


我写了一个插件,它解决了这个问题:adi.dropdownmenu。您可以使用它,取消分配内容上方的“扩展导航”-portlet(由collective.portlet.sitemap提供),并在内容下方分配一个,将目标深度设置为1,就是这样。

我喜欢这个,但我已经用CSS隐藏了#portal globalnav,这意味着我现在隐藏了两个#portal globalnav:-)。如果有帮助的话,我愿意删除CSS位。我怀疑答案可能是你的答案和下面罗斯的答案的混合。
<browser:viewlet
        name="trueblade.phoenix.footer2"
        manager="plone.app.layout.viewlets.interfaces.IPortalFooter"
        class=".footer2.MyGlobalSectionsViewlet"
        template="footer2.pt"
        permission="zope2.View"
        />
from plone.app.layout.viewlets.common import GlobalSectionsViewlet

class MyGlobalSectionsViewlet(GlobalSectionsViewlet):
    pass
<tal:sections tal:define="portal_tabs view/portal_tabs"
 tal:condition="portal_tabs"
 i18n:domain="plone">
<h5 class="hiddenStructure" i18n:translate="heading_sections">Sections</h5>

<ul id="footer2"
    tal:define="selected_tab python:view.selected_portal_tab"
    ><tal:tabs tal:repeat="tab portal_tabs"
    ><li tal:define="tid tab/id"
         tal:attributes="id string:portaltab-${tid};
                        class python:selected_tab==tid and 'selected' or 'plain'"
        ><a href=""
           tal:content="tab/name"
           tal:attributes="href tab/url;
                           title tab/description|nothing;">
        Tab Name
        </a></li></tal:tabs></ul>
</tal:sections>
#footer2 {
    display: none;
}

.section-front-page #footer2 {
    display: block;
    margin: 1em;
}
#footer2 {
    clear: both;
    font-size: 80%;
    background: #ddd;
    /* ensure top navigation dont touches portlets, content etc.. #10491 */
    margin: 0 0 1em 0;
    text-align: center;
}
#footer2 li {
}
#footer2 li a {
    display: inline-block;
    padding: 0.5em 1em 2em 1em;
    background: #ddd;
    min-width: 6em;
    white-space: normal;
    /*TODO: Once we have removed the whitespace from the nav template, this can be put back*/
    /*border-bottom: 0.1em solid White;*/
    border-right: 0.1em solid white;
}

#footer2 .selected a,
#footer2 a:hover {
    background: #205c90;
    color: White;
}
#footer2 .selected a:hover {
    background: #ddd;
    color: #205c90;
}