问题
I'm trying to add my logo to the top navbar like this:
I modified the xml file addons\web\static\src\xml\menu.xml
and added this div:
<div style="height: 100%;display: block;float: left;margin-right: 15px;margin-left: 15px;">
<img src="https://www.clubsportive.nl/wp-content/uploads/2018/12/logo-example.jpg" height=100%/>
</div>
inside the header like this:
<header t-name="Menu" style="background-color: #4c4c4c;">
<nav class="o_main_navbar">
<ul class="o_menu_apps"/>
<div style="height: 100%;display: block;float: left;margin-right: 15px;margin-left: 15px;">
<img src="https://www.clubsportive.nl/wp-content/uploads/2018/12/logo-example.jpg" height=100%/>
</div>
<a class="o_menu_brand" role="button"/>
<ul class="o_menu_sections" role="menu"/>
<ul class="o_menu_systray" role="menu"/>
</nav>
</header>
But it breaks everything. I see only white page after the change. And there are errors inside the console:
What is wrong?
回答1:
Your code will work fine, change height=100 to height="100" [Use double quotes]
The error you get is xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 8, column 102 -, you can check it from log file.
Note: its always recommended to inherit than editing original code.
来源:https://stackoverflow.com/questions/57356853/add-logo-to-the-backend-top-navbar