تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
17171 أدوات العرض

Hi,

I have problem with Odoo 12 theme tutorial, when i code "layout.xml"

<!-- Customize header  -->
<template id="custom_header" inherit_id="website.layout" name="Custom Header">

  <!-- Assign an id  -->
  <xpath expr="//div[@id='wrapwrap']/header" position="attributes">
    <attribute name="id">my_header</attribute>
  </xpath>

  <!-- Add an element after the top menu  -->
  <xpath expr="//div[@id='wrapwrap']/header/div" position="after">
    <div class="container">
      <div class="alert alert-info mt16" role="alert">
        <strong>Welcome</strong> in our website!
      </div>
    </div>
  </xpath>
</template>


running display error

Element '<xpath expr="//div[@id='wrapwrap']/header/div">' cannot be located in parent view
Error context:
View `Custom Header`
[view_id: 522, xml_id: n/a, model: n/a, parent_id: 380]
None" while parsing None:4, near
<data inherit_id="website.layout" name="Custom Header"> <!-- Assign an id -->
<xpath expr="//div[@id='wrapwrap']/header" position="attributes">
<attribute name="id">my_header</attribute>
</xpath> <!-- Add an element after the top menu -->
<xpath expr="//div[@id='wrapwrap']/header/div" position="after">
<div class="container">
<div class="alert alert-info mt16" role="alert">
<strong>Welcome</strong> in our website!
</div>
</div>
</xpath>
</data>
 
الصورة الرمزية
إهمال
أفضل إجابة
<xpath expr="//div[@id='wrapwrap']/header/div" position="after">

In the above code change div to nav. Then you can see "Welcome in our website!" in the website app......
الصورة الرمزية
إهمال

why did that work?

المنشورات ذات الصلة الردود أدوات العرض النشاط
2
ديسمبر 23
14760
0
أكتوبر 23
33
3
أكتوبر 23
788
1
أكتوبر 23
569
1
أغسطس 23
2488