Thanks to some very valuable input from this forum I am making good progress on theming.
Now I would like to show a block of HTML on the home page only which looks like:
<template id="x_mytheme.home" name="My Home" page="True">
For testing purposes I'm using a copy of website.layout which I'm editing:
<template id="x_mytheme.layout" name="My Layout"><!DOCTYPE html>
<div id="content-top" class="row">
The HTML block needs to show below #content-top; I know this works when I inherit my layout:
<xpath expr="//div[@id='content-top']" position="after">
This affects every page that calls my layout though. How can I do this when this layout is called inside another view with t-call?
Btw, any idea how I can add this code below to source? Am I right in presuming it is stripped from the source before building the HTML?
<!--[if lt IE 9]>
Is there any info on how Odoo handles this kind of conditional statements?
I could solve this by using an if condition:
<div t-if="condition"> <p>Test</p> </div>
where condition is a check that the current view using the layout is the home page. But I can't figure out how to do that.
EDIT: I found it
I do this in my main layout:
<t t-if="xmlid == 'website.home'">
I tried with xml_id as I found that in the ORM guide, is there a way to have all these available variables or where can I learn more about them?
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
|Asked: 3/3/15, 6:39 AM|
|Seen: 1573 times|
|Last updated: 3/16/15, 8:10 AM|