In my Evolve theme, there is a section to custom the footer with the following text:
Available HTML tags and attributes: <b> <i> <a href="" title=""> <blockquote> <del datetime=""> <ins datetime=""> <img src="" alt="" /> <ul> <ol> <li> <code> <em> <strong> <div> <span> <h1> <h2> <h3> <h4> <h5> <h6> <table> <tbody> <tr> <td> <br /> <hr />
When I try to use them, nothing happens, the html code is shown as simple text.
Does anybody know this issue?
Why not editing the footer.php?
<?php $footer_content = evl_get_option('evl_footer_content','');
if ($footer_content === false) $footer_content = '';
echo esc_attr($footer_content);
?>
Push your HTML to $footer_content = 'insert here'.
If we have the same version of 'Evolve' you can find it at line 88 - 91 in footer.php.
Related
I have a list of items:
<div class="item">
<a href="//external-link.com">
<img src="main-image.jpg" alt=""/>
</a>
<h2> Title </h2>
<p> Description lorem here </p>
</div>
<div class="item">
<a href="//external-link.com">
<img src="main-image.jpg" alt=""/>
</a>
<h2> Title </h2>
<p> Description lorem here </p>
</div>
<div class="item">
<a href="//external-link.com">
<img src="main-image.jpg" alt=""/>
</a>
<h2> Title </h2>
<p> Description lorem here </p>
</div>
I want to extract the text of the <h2> tag, and the "src" and "href" of the <a> and <img> tags, but I can't figure out how to extract the "src" and "href" attributes.
This is something like what I'm using:
require 'nokogiri'
require 'open-uri'
pageURL = 'http://ticketdriver.com/amg/buy/tickets'
page = Nokogiri::HTML(open(pageURL), nil, 'UTF-8')
page.css('.item').each do |node|
title = node.css('h2').text
srcUrl = node.css('img')['src']
end
The text part is working but I can't access the key and value for child elements of ".item". I tried children[0], [0]['src'] , [:src], attr(), attribute() and a few more.
I'm completely out of ideas and Google search pages.
I'd do something like:
doc = Nokogiri::HTML(<<EOT)
<html><body>
<div class="item">
<a href="//external-link.com">
<img src="main-image1.jpg" alt=""/>
</a>
<h2> Title1 </h2>
</div>
<div class="item">
<a href="//external-link.com">
<img src="main-image2.jpg" alt=""/>
</a>
<h2> Title2 </h2>
</div>
<div class="item">
<a href="//external-link.com">
<img src="main-image3.jpg" alt=""/>
</a>
<h2> Title3 </h2>
</div>
</body></html>
EOT
items = doc.search('.item').map { |item|
{
title: item.at('h2').text,
src: item.at('img')['src']
}
}
Which results in:
items
# => [{:title=>" Title1 ", :src=>"main-image1.jpg"},
# {:title=>" Title2 ", :src=>"main-image2.jpg"},
# {:title=>" Title3 ", :src=>"main-image3.jpg"}]
I'm deliberately only getting the "src" attribute from the <img> tag. Given the code above you can figure out how to get what you want from the <a> tags.
Notice that I'm using the generic search rather than css. Nokogiri is smart enough to differentiate between CSS and XPath selectors most of the time. The only time I use either css or xpath is when Nokogiri can't figure it out. I use CSS because it's generally simpler and more easily read.
Also, notice that I don't use node.css('h2').text. css returns a NodeSet, which is akin to an Array, whereas at returns a single Node. In your code you're masking the difference between the two, but using css, xpath or the generic search is a bug in waiting. Consider this:
require 'nokogiri'
doc = Nokogiri::HTML(<<EOT)
<html><body>
<p>foo</p>
<p>bar</p>
<p>baz</p>
</body></html>
EOT
doc.search('p').text # => "foobarbaz"
doc.at('p').text # => "foo"
What this means is, if search or one of its specific methods returns a NodeSet, text will return the text of all Nodes in that set, which is rarely what you want. Instead, you need to use at to find the specific child-node you want and then extract its text. How you do that is a different question, but it's easily done.
I have a PDF report, using qWeb in Odoo (v8). My report has this line of code:
<t t-call="report.external_layout">
This line I suppose is for inserting the predefined header in the PDF report. In Settings -> Companies, tab Report Configuration in respective company, there is something like this:
<header>
<pageTemplate>
<frame id="first" x1="1.3cm" y1="3.0cm" height="21.7cm" width="19.0cm"/>
<stylesheet>
<!-- Set here the default font to use for all <para> tags -->
<paraStyle name='Normal' fontName="DejaVuSans"/>
<paraStyle name="main_footer" fontSize="8.0" alignment="CENTER"/>
<paraStyle name="main_header" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
</stylesheet>
<pageGraphics>
<!-- Set here the default font to use for all <drawString> tags -->
<setFont name="DejaVuSans" size="8"/>
<!-- You Logo - Change X,Y,Width and Height -->
<image x="1.3cm" y="27.7cm" height="40.0" >[[ company.logo or removeParentNode('image') ]]</image>
<fill color="black"/>
<stroke color="black"/>
<!-- page header -->
<lines>1.3cm 27.7cm 20cm 27.7cm</lines>
<drawRightString x="20cm" y="27.8cm">[[ company.rml_header1 ]]</drawRightString>
<drawString x="1.3cm" y="27.3cm">[[ company.partner_id.name ]]</drawString>
<place x="1.3cm" y="25.3cm" height="1.8cm" width="15.0cm">
<para style="main_header">[[ display_address(company.partner_id) or '' ]]</para>
</place>
<drawString x="1.3cm" y="25.0cm">Phone:</drawString>
<drawRightString x="7cm" y="25.0cm">[[ company.partner_id.phone or '' ]]</drawRightString>
<drawString x="1.3cm" y="24.6cm">Mail:</drawString>
<drawRightString x="7cm" y="24.6cm">[[ company.partner_id.email or '' ]]</drawRightString>
<lines>1.3cm 24.5cm 7cm 24.5cm</lines>
<!-- left margin -->
<rotate degrees="90"/>
<fill color="grey"/>
<drawString x="2.65cm" y="-0.4cm">generated by Odoo.com</drawString>
<fill color="black"/>
<rotate degrees="-90"/>
<!--page bottom-->
<lines>1.2cm 2.65cm 19.9cm 2.65cm</lines>
<place x="1.3cm" y="0cm" height="2.55cm" width="19.0cm">
<para style="main_footer">[[ company.rml_footer ]]</para>
<para style="main_footer">Contact : [[ user.name ]] - Page: <pageNumber/></para>
</place>
</pageGraphics>
</pageTemplate>
</header>
I changed some lines in order to print the header just like I need it. When I press button Preview Header/Footer, it shows everything just like I typed it, but I doesn't work when I print the report: header is still printed like it was by default. Some threads in forums say to uncheck the Reload from Attachment checkbox... in my case, it always has been unchecked.
As you can see, header is typed in RML form, and my report is in qWeb... Is this a problem? If it is it, how to fix it?
So, how to edit (... and make it to work ...) the PDF report default header???
Thanks in advance.
To define your custom header in qweb report by giving a header class to div tab like
<template id="your_custom_layout_header">
<div class="header">
<div class="row">
<div class="col-xs-3">
<img t-if="company.logo" t-att-src="'data:image/png;base64,%s' % company.logo" style="max-height: 45px;"/>
<!-- All your custom code here -->
</div>
</div>
</div>
<div class="footer">
<div class="row">
<!-- All your custom code here -->
</div>
</div>
</template>
Hear In Qweb there are Two different classes for set the custom header and Footer in div tag can directly set the custom header set as the header class in div and footer class set as the footer in div tag.important think is that we do not add any external or internal header and footer in your view file Just add the below tag.
<div class="header">
<div class="row" style="border-bottom: 1px solid black;">
<div class="col-xs-3">
<img t-if="company.logo" t-att-src="'data:image/png;base64,%s' % company.logo" style="max-height: 45px;"/>
<div t-field="company.partner_id"
t-field-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": true}' />
</div>
<div class="col-xs-5 pull-right" style="margin-top:5px;">
<t t-if="company.vat">
<b>GST ID :</b>
<span t-field="company.vat" /><br/>
</t>
<t t-if="company.phone">
<b>PHONE :</b>
<span t-field="company.phone" /><br/>
</t>
<t t-if="company.fax">
<b>FAX :</b>
<span t-field="company.fax" /><br/>
</t>
<t t-if="company.email">
<b>EMAIL :</b>
<span t-field="company.email" /><br/>
</t>
<t t-if="company.website">
<b>WEBSITE :</b>
<span t-field="company.website" />
</t>
</div>
</div>
</div>
<div class="footer">
<div class="text-center" style="border-top: 1px solid black;">
<ul class="list-inline">
<li>Page:</li>
<li><span class="page"/></li>
<li>/</li>
<li><span class="topage"/></li>
</ul>
</div>
</div>
header and footer class automatically set the custome header and footer for that report in Qweb.
The code which I showed off you which is working fine from my side.
I hope this should helpful for you ..:)
I have the following html structure:
<div class="ms-PostFooter">
<span style="">
<span style="" class="s4-clust">
<a href="#" style="">
<img src="" alt="" style="l" title="" class="imglink" longDesc="" />
</a>
</span>
</span>
<span style="">
<span class="s4-clust">
<a href="#" style="">
<img src="" alt="" style="" title="" class="imglink" longDesc="" />
</a>
</span>
</span>
<span style="">
<span class="s4-clust">
<a href="#" style="">
<img src="" alt="" style="" title="Number of Comments" class="imglink" longDesc="" />
</a>
</span>
</span>
</div>
In css how would I select the third tag in order to hide the image with title "Number of Comments"?
.ms-PostFooter span::nth-child(3) img {
display: none;
}
or this also works:
img[title="Number of Comments"] {
display: none;
}
however these rely on your markup / content. the best way would be - generate a specific class on that image or its container, server-side (if you can)
One possibility if your title is unique:
[title="Number of Comments"]
{
display:none;
}
You can use the following:
div :last-child span .imglink{
display:none;
}
jsfiddle: http://jsfiddle.net/kGThS/1/
This may be more specific:
.ms-PostFooter :last-child span .imglink{
display:none;
}
jsfiddle: http://jsfiddle.net/kGThS/3/
To hide the entire last span/link as per your comment below use the following:
.ms-PostFooter :last-child span{
display:none;
}
Somehow through css sharepoint was not allowing me to use any of the selectors mentioned here through css to get rid of the specif tag containing the link and image to be removed so I decided to use jquery instead which did the trick as follows:
$( document ).ready(function() {
$('DIV.ms-PostFooter span:nth-child(3)').css('display', 'none');
$('DIV.ms-PostFooter span:nth-child(4)').css('display', 'none');
});
Thanks for all the assistance.
I am using TinyMce to compose emails then I am saving emails in database. There need to open email in read only mode as well. Top show mail just in readonly mode I inserted email tags in a div but in display inserted text was not begin shown as a display of HTML tags, rather tags where there in div. I am using div.InnerHtml to add email HTML but div is showing tags like:
<p>
<strong>hi,</strong>
</p>
<div>
<span style="color: #800000;">
Since the application that he demands require information gathering,
screen designing and development, I have forwarded the project to the team
I am working with.
</span>
</div>
<div><br /></div>
<div>
<span style="color: #ff6600;">
<strong>
<span style="font-size: medium;">Thanks,</span>
</strong>
</span>
</div>
<div>
<strong>
<span style="font-size: medium;"><br /> </span>
</strong>
</div>
<div style="text-align: right;">
<span style="font-size: medium;">
<em>
<span style="text-decoration: underline;">
<span style="color: #339966;">Mr. Bota</span>
</span>
</em>
</span>
<br />
</div>
You should use an asp.net Literal control, and set the LiteralMode to `PassThrough'. You can read a bit more here: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.literalmode.aspx.
This should allow the HTML you emit to actually be rendered, instead of seeing the tags.
Use a literal control for this:
<asp:Literal ID="litEmailBody" runat="server" />
And in the code behind:
litEmailBody.Text = htmlContent; //your HTML markup
I want posting in my website to be as rich HTML tags as possible, but safe.
this is tags used in my website:
<a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <font> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <embed> <object> <param> <strike> <caption> <s> <textarea>
my website is in drupal.. and when viewing front page (/node), the layout broken
What is your DOCTYPE? If your type is XHTML then
<hr> and <br>
should never be used.