What is the easiest way to move globalnav to the footer, only on the first page

I hid the various elements of a regular Plone page with:

.section-front-page #portal-globalnav {
    display: none;
}

Now I want to add globalnav to the bottom of the footer. I reviewed various approaches:

  • View / browser template selected through the "Screen" menu
  • Another viewport
  • Javascript (OK, I did not consider this because I do not know Javascript very well, but it seems possible.)

What is the best approach?

+5
source share
4 answers

I liked both sentences, but I ended up doing the following (because I could not see how to do everything I wanted with the other sentences):

<browser:viewlet
        name="trueblade.phoenix.footer2"
        manager="plone.app.layout.viewlets.interfaces.IPortalFooter"
        class=".footer2.MyGlobalSectionsViewlet"
        template="footer2.pt"
        permission="zope2.View"
        />

With footer2.py like this (to subclass and nothing more):

from plone.app.layout.viewlets.common import GlobalSectionsViewlet

class MyGlobalSectionsViewlet(GlobalSectionsViewlet):
    pass

footer2.pt ( , CSS):

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

CSS ( footer2 ):

#footer2 {
    display: none;
}

.section-front-page #footer2 {
    display: block;
    margin: 1em;
}

, , 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;
}
+2

Plone 4 viewlet:

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

main_template, :

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

- . GS, , ZCML plone.global_sections IPortalFooter :

<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.global_sections IPortalHead display: none;

<browser:viewlet
    name="plone.global_sections"
    for="my.special.IFrontPage"
    manager="plone.app.layout.viewlets.interfaces.IPortalHeader"
    class="my.special.EmptyViewlet"
    permission="zope2.View"
    />
+3

There is a much less time-consuming and non-intrusive approach, not using widgets, but portlets.

Products.ContentWellPortlets allows you to place portlets above and below the content.

I wrote an addon that addresses this: adi.dropdownmenu. You can use it, unassign the "Advanced Navigation" portlet (delivered from collect.portlet.sitemap) above the content and assign it below the content, set the target depth to 1 so that it is.

+1
source

All Articles