Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
3 Trả lời
15474 Lượt xem

I am a complete newbie.

I want to change the default navbar and footer with my own templates. Right now I'm editing the /addons/website/views/website_templates.xml file, but nothing changes. 

I want to edit the following page : http://pho.to/Ain4b (Remove odoo logo and change the contact us, about us information and add some css on hovering the home, contact us etc links)

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hello,


If you want to change the navbar and footer you need to find the template respectively and then you can inherit it and replace, then you can change according to your need. In your case, 


for navbar, 




<template id="website_navbar_theme_template" inherit_id="website.template_header_default" name="Template Header Theme" active="True">


<xpath expr="//t[@t-call='website.navbar']" position="replace">


<div id="wrap" class="oe_structure oe_empty">


 """Add your required data here"""


</div>


            </xpath>


</template>




for footer,




<template id="footer_layout_website" name="Main layout" inherit_id="portal.frontend_layout">


<xpath expr="//footer" position="replace">


<footer>


<div class="container-fluid">


"""Add your requirements here"""


</div>


</footer>


</xpath>


</template>




for contact us page,




<template id="website_contactus" inherit_id="website.contactus">


<xpath expr="//t" position="replace">


<t t-call="website.layout">


<div id="wrap" class="oe_structure oe_empty">


<div class="container-fluid ">


<div class="container ">


<div class="row">


 """Add contact us information here"""


</div>


</div>


</div>


</div>


</t>


</xpath>


</template>




Like this, find the template of needed pages and inherit it and replace it. If there is no template, create a new template by calling


 <t t-call="website.layout"> inside the template. and from the controllers return to that page when menu click.


Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi Ashish,

You have to create a custom addon that overrides existing templates like "contactus", "aboutus" etc.. Your file  website_templates.xml exactly correct. If you are changing the contents directly, You have to upgrade that module after your editings. Then only it will effect the website template.


Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất
<odoo>
    <template id="theme_custom.new_homepage" inherit_id="website.homepage">
<xpath expr="//div[@id='wrap']" position="replace">
<div id="wrap" class="oe_structure">
              hello
</div>
</xpath>
</template>
</odoo>
Try this

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
5
thg 2 24
23968
0
thg 7 18
2573
4
thg 7 18
11492
2
thg 7 18
2969
2
thg 11 17
4459