Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

1

Display xml code in the frontend with <pre> tags?

By
Mercedes Scenna
on 11/17/15, 4:46 AM 1,136 views

While creating a  pattern library for a project I encountered the problem of displaying xml code in the frontend in <code> or <pre> didn't work. The code is placed in a new view, a new page.

What I wanted to do is to have this shown in the frontend exactly so: 

<a class='btn btn-primary' href='#'>Confirm</a>

I don't want to show the actual button. So my code looks like this:

<pre>
&lt;a class='btn btn-primary' href='#'&gt;Confirm &lt;/a&gt;
</pre>

In this case, Odoo still renders the code inside the <pre> tags and displays the button.

I tried also replacing the pre for code element, a combination of pre and code, using CDATA. In every case, the button will be rendered instead of the xml markup.

<![CDATA[&amp;lt;a class='btn btn-primary' href='#'&amp;gt;Confirm &amp;lt;/a&amp;gt;]]>


The only (current) way I found so far is to put spaces in the tags, it's the only thing that keeps the code from being rendered:

<pre>
&lt;a class='btn btn-primary' href='#'&gt; Confirm &lt;/a&gt;
</pre>

 

Thanks in advance for any help!

I can't understand your question. Perhaps a screenshot would help me and others to help you. "This is what I want". "This is what it looks like". "This is what it looks like if I put spaces in the tags". I'm not clear on WHERE this is happening.

Bista Solutions US, Ray Carnes
on 12/2/15, 9:58 PM

I updated the question. Hope it's more understandable now

Mercedes Scenna
on 12/3/15, 8:30 AM

Your Answer

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

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 11/17/15, 4:46 AM
Seen: 1136 times
Last updated: 12/3/15, 8:30 AM