How to move searchbar in Plone5

0 votes

I'm new to Plone 5 and I'm actually following the plone training. However, I'm not used to the way that all is build. I would like to do simple things but I don't know where to start. For example:

  • How can I move the search bar from the header to the navbar menu?

  • How can I add an image to the header next to the logo?

  • Is there any tutorial that can help me?

Oct 10, 2018 in Python by eatcodesleeprepeat
• 4,710 points
566 views

1 answer to this question.

0 votes

You can install the add-on Products.ContentWellPortlets and replace the top-viewlets with portlets, by adding a portlets.xml in one of your add-on's profiles.

This example adds a logo and an image next to it:

<?xml version ="1.0"?>
<portlets>

 <!-- Assign Logo-portlet to site-root (key='/'): -->
 <assignment name="top" category="context" key="/"
    manager="ContentWellPortlets.InHeaderPortletManager1"
    type="plone.portlet.static.Static" visible="True">

  <!--
   Give this portlet a name, so we can recognize it easily in the
   portlet-management-UI via `[PLONESITE_URL]/manage-portletsinheader`:
   -->
  <property name="header">Logo</property>

  <!-- But don't show its header and footer when viewing the portlet: -->
  <property name="omit_border">True</property>

  <!-- Replace 'Plone' with your site-id here, in case it differs: -->
  <property name="text">
     &lt;a href="/Plone">
       &lt;img src="logo.png" />
     &lt;/a>
   </property>

 </assignment>

 <!-- Assign another portlet in next column (InHeaderPortletManager2): -->
 <assignment name="top" category="context" key="/"
    manager="ContentWellPortlets.InHeaderPortletManager2"
    type="plone.portlet.static.Static" visible="True">
  <property name="header">Some image next to Logo</property>
  <property name="omit_border">True</property>

  <property name="text">
    &lt;img src="defaultUser.png"
        title="Dummy-user-avatar" />
   </property>

 </assignment>

</portlets>

And polish it with some styling.

For the search-box I'd may assign a search-portlet above the content (using ContentWellPortlets), give it a minus-margin-top and for the globnav a margin-right, but as there's many ways to Rome, I'd might replace the globnav with a navigation-portlet, too.

Here's an add-on for illustration-purposes (see its viewlets.xml on how to hide the top-viewlets):https://github.com/ida/adi/tree/master/adi.samplestructure

answered Oct 10, 2018 by Priyaj
• 58,020 points

Related Questions In Python

+3 votes
5 answers

How to read multiple data files in python

Firstly we will import pandas to read ...READ MORE

answered Apr 6, 2018 in Python by DeepCoder786
• 1,720 points
15,334 views
+4 votes
7 answers
0 votes
1 answer

How to hide a window in the constructor immediately after creation?

You can use QtCore.QTimer class Example(QWidget):     def __init__(self, app):         QWidget.__init__(self)         QTimer.singleShot(0, ...READ MORE

answered Apr 17, 2018 in Python by anonymous
934 views
+1 vote
12 answers
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,466 views
0 votes
1 answer
+1 vote
1 answer

How to create plots using python matplotlib in IPython notebook?

I think you should try: I used %matplotlib inline in ...READ MORE

answered Aug 8, 2018 in Python by Priyaj
• 58,020 points
1,619 views
0 votes
3 answers

How to get the current time in Python

FOLLOWING WAY TO FIND CURRENT TIME IN ...READ MORE

answered Apr 8, 2019 in Python by rajesh
• 1,270 points
2,100 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP