Skip to Content
Menu
This question has been flagged
3 Replies
2180 Views

Hi !


First, I would like to apologize because English is not my native language.

I have a question about the WebsiteBuilder module in Odoo V8.

I am a beginner on Odoo...so I am trying things to see if it works or not.


I would like to know if it possible to display a page content (or a part of a page content) in another page.

To be clear, I have created 2 pages. PageX and PageY.

I'd like to display the content of PageY on PageX.


I tried to "just" call the page name, like that :


<t t-name="PageY"> 
<t t-call="website.layout">
<div id="wrap" class="oe_structure oe_empty">
<div class="oe_structure">
PageY content
</div>
</div>
</t>
</t>

<t t-name="PageX">
<t t-call="website.layout">
<div id="wrap" class="oe_structure oe_empty">
<div class="oe_structure">
PageX content
<t t-call="PageY" />
</div>
</div>
</t>
</t>

This works but on PageX, the header, the menu and the footer are display twice. (That is normal...)

Is there a way to add only the content of the page ?

Something like that : 

<t t-name="PageY"> 
<t t-call="website.layout">
<div id="wrap" class="oe_structure oe_empty">
<div class="oe_structure">
<t t-name="pageY_content">PageY content</t>
</div>
</div>
</t>
</t>

<t t-name="PageX">
<t t-call="website.layout">
<div id="wrap" class="oe_structure oe_empty">
<div class="oe_structure">
PageX content
<t t-call="pageY_content" />
</div>
</div>
</t>
</t>

I tried but the t-name="PageY_content" declaration is not recognized by the system.

I tried to create a "hidden page" (not visible by the menu) and called it "PageY_content". I have the following error :

Odoo Warning

ValidateError

Field(s) 'arch' failed against a constraint:Invalid view definition

Error details: Model not found : False

Error content : View 'pageX' [view_id:xxxx, xml_id:website.pageX,> model:n/a, parend_id:n/a]


I would like to know if there is a way to have this result "properly" ? 

Is the "PageCeption" system impossible to implement or contrary to a good use of the module?

Would it be possible, using the HTML editor, to create the content elsewhere and be able to call it wherever I want?


Thank you in advance for your assistance

Avatar
Discard
Author

Hi !

Thanks for your help !

Do you know where I need to create this template ? I tried to add it in the website_templates.xml file and then I "updgraded" the website builder module.

But when I try to call it in one of my pages, I have the following error :

500 : Internal Server Error

Error message : Invalid template id 'contentY_id'

QWeb Error message : Loader could not find template 'contentY_id'

Do you know how to solve this problem ? And is there a way to display the new template in the HTML editor ?

Author Best Answer

Hi !

I finally managed to call the template anywhere I want.

And I managed to display it in the HTML editor. But now, do you know if there is a way to "edit" the content of the template using the graphical editor (instead of the HTML editor) of the website module ? 

My new template is not really a page, so I can not access it from a menu or from the URL. I can only edit it using the HTML editor.

 

<t t-name="mytemplate"> Editable in the HTML editor but not editable using the graphical editor
<!-- content of my template -->
</t>

<t t-name="myPage"> Editable in the HTML editor AND editable using the graphical editor
<!-- content page -->
<t t-call="mytemplate" /> (this display the content of mytemplate)
</t>

<t t-name="myOtherPage"> Editable in the HTML editor AND editable using the graphical editor
<!-- content page -->
<t t-call="mytemplate" /> (this display the content of mytemplate)
</t>
Avatar
Discard
Best Answer

create one template that you need to use in both page and don't use <t t-call="website.layout"> in this template .

<template id="contentY_id">
     <!--Your_pageY_content-->
</template>

and use this template in both page like this,

<t t-name="PageX">
    <t t-call="website.layout">
        <div id="wrap" class="oe_structure oe_empty">
            <div class="oe_structure">

                <!--Your_pageX_content-->

                <t t-call="contentY_id"/>
            </div>
        </div>
    </t>
</t>

<t t-name="PageY">
    <t t-call="website.layout">
        <div id="wrap" class="oe_structure oe_empty">
            <div class="oe_structure">
                <t t-call="contentY_id"/>
            </div>
        </div>
    </t>
</t>

I hope this will helps you. 

Avatar
Discard
Related Posts Replies Views Activity
0
Sep 16
5685
0
Nov 24
61
1
Nov 24
243
0
Oct 24
244
1
Oct 24
1487