I have the following html file:
<!DOCTYPE html>
<html>
<head>
<title></title>
<link href="https://fonts.googleapis.com/css?family=Montserrat|Ubuntu" rel="stylesheet">
</head>
<body>
<div id = 'container' style="height:500vh;width:88vw;margin:0 auto;color:#365f91;font-family:'Montserrat', sans-serif;font-size:1.75vw">
<div style="display:flex;justify-content:space-between;margin-top:6vh;margin-bottom:1.5vh;">
<div style='display:flex;flex-direction:column;justify-content:space-between;'>
<p style="margin:0;color:#38761d;font-weight:bold;font-size:2.75vw;">SWAG Newsletter Fall 2021</p>
<span style="display:block;margin-bottom:1.5%;color:#9bbb59;font-weight:bold;font-size:2.5vw">LATEST NEWS</span>
</div>
<img style = "right;width:25%" src="cid:pic1" >
</div>
<span style="display:block;color:#23456c;font-weight:bold;">Weston Power Choice: Awaiting DPU Approval</span>
<p style="margin:0">
<img style="float:left;width:25%;margin-right:2%;margin-top:1vh;" src="cid:pic2">
Weston Power Choice is still alive! The Town submitted its aggregation plan for
Weston Power Choice to the Department of Public Utilities(DPU) on October 29, 2020.
While we certainly wish we could accelerate this process, it is still sitting in the
DPU review pipeline. Once the plan is approved, the Town will select an electricity
supplier and, in close cooperation with SWAG, inform the community on next steps.
</p><br>
<span style="display:block;color:#23456c;font-weight:bold;">Pay-As-You-Throw: Implemented and Moving Forward</span>
<p style="margin:0%">
<img style="float:left;width:21%;margin-right:2%;margin-top:1%;" src="cid:pic3">
SWAG helped the Town's Pay-As-You-Throw (PAYT) implementation by staffing an information
table at the Weston transfer station on September 25th and October 2nd. During the preceding
months, SWAG shared a steady stream of resources on reducing waste through composting,
reusing and recycling. Aftersome initial challenges, the PAYT program is now running smoothly.
While it's too early to determine the program's impact on the town's waste volumes, the transfer
station has seen a noticeable increase in food waste going into the compost bins.
</p>
<br>
<span style="display:block;color:#23456c;font-weight:bold;">Weston Ahead: Continues to Make Headway</span>
<p style="margin:0%">
<img style="float:left;width:20%;margin-right:2%;margin-top:1%;" src="cid:pic4">
The Town is working hard to make progress on the goals set in the <a href="https://www.westonma.gov/1486/Weston-Ahead">
Climate Action & Resilience Plan</a>. Efforts completed/underway include: launching Pay-As-You-Throw at the transfer
station, replacing all street lights with LED's, conducting a Tree Survey with residents about interest in tree protections,
pursuing a zero-energy bylaw, evaluating the feasibility of moving Town Hall from oil to electric heat, upgrading HVAC
systems at the schools for health and energy effiency, and much more.
</p>
<br>
<span style="display:block;color:#23456c;font-weight:bold;">Weston Plant Pollinator Alliance (WPPA): Display Garden Installed,
2nd on the Way</span>
<p style="margin:0%;margin-bottom:2vh;">
<img style="float:left;width:15%;margin-right:2%;margin-top:1%;" src="cid:pic5">
Are you interested in learning more about native plants, wild pollinators, and actions you can take
at home to support at-risk species? The Weston Plant Pollinator Alliance(WPPA) <a href="https://www.wppama.org/">
website</a> is a comprehensive resource highlighting local native pollinator conservation efforts. The first
WPPA public pollination preservation display garden, installed last
May at the Concord Rd. entrance to the Weston segment of the MassCentral Rail Trail, contains examples of beneficial
native plants anyone can add to their yards to support at-risk pollinators. The WPPA continues to interface with local
groups and organizations to increase pollinator resources and habitat in existing gardens throughout Weston, including
a second public display garden planned for Spring 2022 installation.
</p>
<br>
<span style="display:block;margin-bottom:0%;color:#9bbb59;font-weight:bold;font-size:2vw">UPCOMING EVENTS & ACTIONS</span>
<ul style="padding:2vw;margin-top:0">
<li style='margin-bottom:.5%;'><span style= "color:#23456c;font-weight:bold;">Interested in driving Impact in your Community?</span>
SWAG is always looking for passionate volunteers. Join our monthly meetings on the second Thursday of each month and
find out which topic(s) excite you. Meeting information can be found on the
SWAG website.
</li>
<li style='margin-bottom:.5%;'><span style= "color:#23456c;font-weight:bold;">Annual Weston School-Wide Clean Up Day: November
11th from 9-11 am.</span> Bring your family and help
pick up trash around the school grounds!
</li>
<li style='margin-bottom:.5%;'><span style= "color:#23456c;font-weight:bold;">National Recycling Day: November 15th.</span>
Check out the SWAG calendar
for presentations on recycling and reducing waste during November!
</li>
<li style='margin-bottom:.5%;'><span style= "color:#23456c;font-weight:bold;">Creating a More Energy-Efficient House:
November 16th.</span> Hear three local residents describe how they cut their use of fossil fuels and saved money. Find
out more here.
</li>
<li style='margin-bottom:.5%;'><span style= "color:#23456c;font-weight:bold;">Land's Sake Farm Environmental Education:
Sign-up for Winter Programs!</span> After-school programs have started this week but there are still a few spots
left in the Tue K-grade 2 and Thu grade 3-6 programs. Sign-up quickly to secure your spot!
</li>
</ul>
<p style="float:right;font-size:1vw">SWAG Quarterly Newsletter <br>Update No.10 11/07/21</p>
<br>
<p style='height:2vh;width:100%;background-color:darkgrey;'></p>
<br>
<span style="display:block;margin:3vh 0;color:#9bbb59;font-weight:bold;font-size:2vw">SUSTAINABILITY SPOTLIGHT</span>
<br>
<p style="margin-top:10vh;">Did you know food waste accounts for approximately 25% of the average household's trash? By removing
food from the waste stream, Weston residents can significantly reduce their total waste and carbon footprint, and create
nutrient-rich compost to aid healthy plant growth.</p>
<p>Earlier this year, SWAG launched a campaign to help residents reduce their food (and other) waste streams. And it resonated!
Here are two residents who creatively incorporated composting into their daily life.</p>
<div>
<img style="float:left;width:30%;margin-right:2%;margin-top:1%;" src="cid:pic6">
<p style= "color:#23456c;font-weight:bold;font-size:2vw;">Jeff Barz-Snell</p>
<span style= "display:block;color:#23456c;font-weight:bold;">Tell us about yourself</span>
<p style="margin-top:0">I moved to Weston from Salem in 2018 with my wife and three children. We live in the
parsonage next to the First Parish Church, where I currently serve as the Minister.</p>
<span style= "display:block;color:#23456c;font-weight:bold;">What are you showing in the picture?</span>
<p style="margin-top:0">Clementine and I are next to a Green Cone Food Digester, which we installed in our yard last April.</p>
<span style= "display:block;color:#23456c;font-weight:bold;">How is a Green Cone Food Digester different from a backyard composter?</span>
<p style="margin-top:0">It's an aerobic digester designed to break down all food. You don't put leaves and grass in it,
but you can compost vegetables, fruit, meat, fish, eggs, coffee and even bones. No mixing or turning of material is needed.
The only requirement is a sunny location with good drainage.</p>
<span style= "display:block;color:#23456c;font-weight:bold;">What spurred you to take this action?</span>
<p style="margin-top:0">I've been involved in environmental work for many years. During a presentation last spring on
Trash and Recycling given by the MetroWest Climate Solutions group, the presenter mentioned she used a Green Cone. I was curious.</p>
</div>
<span style= "display:block;color:#23456c;font-weight:bold;">Are the results what you expected?</span>
<p style="margin-top:0">Yes, it works very well and has little or no smell, since most of the unit is buried in the ground.
It did not attract vermin or other animals this summer, which is an important consideration around here.</p>
<span style= "display:block;color:#23456c;font-weight:bold;">Do you see a noticeable reduction in your trash?</span>
<p style="margin-top:0">Definitely. We dump 3-4 lbs of food waste into the digester every 3 days or so. It can
accommodate up to 2.3 lbsper day. Since we don't have a garbage disposal it has made a big difference in the
amount of trash and associated odors we bring to the transfer station. Your trash pick-up service will thank you as well!</p>
<div>
<img style="float:left;width:30%;margin-right:2%;margin-top:1%;" src="cid:pic7">
<p style= "color:#23456c;font-weight:bold;font-size:2vw;">Marc van Zadelhoff</p>
<span style= "display:block;color:#23456c;font-weight:bold;">Tell us a about yourself</span>
<p style="margin-top:0">I live on 44 Silver Hill Road with my wife and three daughters ages 14, 12 and 10.
I run a SaaS software company and when not working, I enjoy spending time with my family, woodworking and doing outdoor sports.</p>
<span style= "display:block;color:#23456c;font-weight:bold;">What are you showing in the picture?</span>
<p style="margin-top:0">It's a compost bin I made from repurposed wood. The wood was originally used for a wheelchair ramp,
which was built for my father before he passed away 2 years ago. I repurposed it to make a compost bin for our yard.
My mother was super happy to see it go to great use.</p>
<span style= "display:block;color:#23456c;font-weight:bold;">What spurred you to take this action?</span>
<p style="margin-top:0">I was inspired by my wife who works in corporate sustainability and by the fact that we were
throwing away a significant amount of compostable food materials. The great thing about composting is once you do it,
you have much less smelly trash and amazing, reusable materials for planting.</p>
</div>
<span style= "display:block;color:#23456c;font-weight:bold;">Are the results what you expected?</span>
<p style="margin-top:0">The compost bin turned out as I expected. It's actually the second one I've built so
I was able to use my first experience to improve on this model. Particularly satisfying was that one of my
neighbors saw it and asked me to build one for her! I love woodworking so I'm now building one for her family.</p>
<span style= "display:block;color:#23456c;font-weight:bold;">Do you have any recommendations for others who want to
emulate your action?</span>
<p style="margin-top:0">Keep it simple and keep in mind that doing something is better than doing nothing.
These bins are pretty easy to construct yourself or you can ask a handy neighbor to do it for you.</p>
<p style="float:right;font-size:1vw">SWAG Quarterly Newsletter <br>Update No.10 11/07/21</p>
</div>
</body>
</html>
php control program:
<?php
require ("../../includes/functions.php");
require ("../../includes/newConstants.php");
$body = file_get_contents('https://sustainablewestonma.org/.swag2/vhtml/newsletter-fall2021.html');
//echo $body;
$mailerInputs['body'] = $body;
$mailerInputs['addAddress'] = "abc123#gmail.com";
mailerExpressBlueHostSWAGpdf($mailerInputs);
?>
and this is my mailer function (mailerExpressBlueHostSWAGpdf())
function mailerExpressBlueHostSWAGpdf(array $mailInputs){
chdir('../');
require_once '../includes/phpmailer/PHPMailerAutoload.php';
$mail = new PHPMailer();
$mail->IsMail();
$mail->SetFrom('swag#sustainablewestonma.org');
$mail->addAddress($mailInputs['addAddress']);
$body = $mailInputs['body'] ;
$mail->addEmbeddedImage("https://sustainablewestonma.org/.swag2/public/images/newsletters/fall2021/Picture1.png", "pic1");
$mail->addEmbeddedImage("https://sustainablewestonma.org/.swag2/public/images/newsletters/fall2021/Picture2.png", "pic2");
$mail->addEmbeddedImage("https://sustainablewestonma.org/.swag2/public/images/newsletters/fall2021/Picture3.png", "pic3");
$mail->addEmbeddedImage("https://sustainablewestonma.org/.swag2/public/images/newsletters/fall2021/Picture4.png", "pic4");
$mail->addEmbeddedImage("https://sustainablewestonma.org/.swag2/public/images/newsletters/fall2021/Picture5.png", "pic5");
$mail->addEmbeddedImage("https://sustainablewestonma.org/.swag2/public/images/newsletters/fall2021/Picture6.png", "pic6");
$mail->addEmbeddedImage("https://sustainablewestonma.org/.swag2/public/images/newsletters/fall2021/Picture7.png", "pic7");
$mail->Subject = "SWAG Fall Newsletter" ;
$mail->Body = $body;
$mail->IsHTML(true);
$mail->ContentType="text/HTML";
if(1==1){
if(!$mail->send()) {
// echo 'mail not sent <br>' ;
$mail->ClearAddresses();
return 'Message could not be sent.' . 'Mailer Error: ' . $mail->ErrorInfo;
}else{
// echo 'mail sent 2<br>';
//echo $body;
$mail->ClearAddresses();
return 'Message has been sent';
}
}
}
All the images are there. Can anyone see why the images are not being embedded?
Your first stop for a question like that should always be the documentation.
You're doing three major things wrong:
Providing a URL to a remote file. This is not supported by PHPMailer; it's not an HTTP client. This is mentioned in the docs on the related addAttachment method, and the same applies here.
If you want to insert the image data directly and not via a local file, you need to use addStringEmbeddedImage.
Having provided an incorrect parameter, you're not checking the return value from the method, so you don't know that it's failing.
Fetching remote resources is your job, not PHPMailer's. To do it yourself you could try:
$image = file_get_contents('https://sustainablewestonma.org/.swag2/public/images/newsletters/fall2021/Picture1.png');
if ($image) {
if (!$mail->addStringEmbeddedImage($image, 'pic1', 'pic1.png')) {
echo 'Could not attach image';
}
} else {
echo 'Fetching image failed';
}
You're doing some other things wrong too:
You're using a very old version of PHPMailer that's no longer supported and probably contains vulnerabilities. Get the latest version, and manage the dependency using composer.
You're calling isMail(). That's the default sending transport, so this does nothing.
You're calling clearAddresses() after sending. This clears the addresses you've added - but your PHPMailer instance goes out of scope in the very next line, so this achieves nothing.
This is likely to break your formatting for recipients:
$mail->ContentType="text/HTML";
MIME types are typically all lower case, and this value is already set correctly by your previous call to isHTML(), so you can delete this line.
You're not checking the return value from addAddress, and given that this value is supplied from outside this function, you won't know if this fails until later when you try to send.
chdir('../');
That's just odd, likely to cause all kinds of strange problems elsewhere in your app. Imagine calling this method in a loop. What's going to happen to your working directory?
I am new to web crawling as well as xpath. However, I am trying to crawl the following website: https://sabobic.blogabet.com/
Basically, I want to extract all "feed_pick_analysis", i.e., all text content which belongs to each post.
I cannot use the statement bellow, because the ID is changing dynamically.
xpath('.//div[#class="feed-pick-title"]/div[#class="col-xs-12 _text-more feed-analysis"]/div[#id="feed_pick_analysis_27759116"]/p').extract()
Thus, I tried to use the following statement:
xpath('.//div[#class="col-xs-12 _text-more feed-analysis"]/div[#contenteditable="false"]/p').extract()
However, I am not even getting any data or tag responded by the website... What is my mistake?
[EDIT] This is the html I am working on:
<div class="col-xs-12 _text-more feed-analysis">
<div contenteditable="false" id="feed_pick_analysis_27759116">
<p>Cant verify asians because nothing is working on this site.<br>
<br>
Game is available in IBC,ISN,SBO<br>
<br>
Game on neutral ground.<br>
<br>
No home advantage for Persipura and thats big minus for them today.<br>
<br>
So Persija will have many fans on the stands, supporting them, so thats more home game for Persija.<br>
<br>
They sign some quality players(Aryanto) and foreigners Xandao and spanish playmaker Tomas who seems to be best player in the league.<br>
<br>
Big value on Persija +0.25 and DNB.<br>
<br>
Fair odds Persija ML #2.10 and dnb #1.50. GL!</p> </div>
<div class="col-xs-12 no-padding margin-top-10">
<small class="last-edit "><em>
last edited: Wed, Sep 11th, 2019, 09:47 </em></small>
</div>
</div>
To make your XPath expression more flexible you can ignore the number in the last #id value. Also note that your expression was missing a space between _text-more and feed-analysis - it has to be _text-more feed-analysis.
.//div[#class="col-xs-12 _text-more feed-analysis"]/div[contains(#id,"feed_pick_analysis")]/p
I merely removed the first div because it was not part of the sample HTML. Add it again, if the expression is not specific enough.
We have embedded rich snippets for a rental objects rating website. Here an example:
http://www.google.de/webmasters/tools/richsnippets?q=http%3A%2F%2Fwww.sonnenquartiere.de%2Fferienwohnungen%2F4-wohnung-8-boardinghaus-norderney-2-zimmer-apartment.html
Works fine when listed in Google search results.
Now we want to aggregate all ratings and post them on the homepage so the homepage itself gets a rating in the Google search results. We did it some time ago:
http://www.google.de/webmasters/tools/richsnippets?q=www.sonnenquartiere.de
We did that some time ago, but the result in the Google Search is still not being displayed with the aggregated rating. Here an Example:
https://www.google.de/search?q=Boardinghaus+Norderney (2nd place here)
Is there something we can do to get this working?
One thing that I did notice about your markup is that you are using the schema.org/WebPage markup for your aggregate review rating. So search engines are seeing that schema as a rating for your home page. You should be using the aggregate rating schema with a schema that better describes your type of business, perhaps something in the schema.org/LodgingBusiness category.
I hope this is not too late and that I will be able to help.
Following the standard procedure is the best practice in such thing. Make sure you use the correct markup. So for review use the reviews-schema as the example below:
Use this tool to generate the code and then modify your website according to this working sample
http://www.microdatagenerator.com/reviews-schema/
For example:
<div itemscope itemtype="http://schema.org/Review">
<div itemprop="itemReviewed" itemscope temtype="http://schema.org/Thing"><span itemprop="name">home mortgage</span> </div>
<div itemprop="author" itemscope itemtype="http://schema.org/Person">
<span itemprop="name"> Nick M.</span>
</div><meta itemprop="datePublished" content = "01/01/2016">
<div itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating"
<meta itemprop="worstRating" content = "1"/><span itemprop="ratingValue">5</span>/<span itemprop="bestRating">5</span> stars </div>
<span itemprop="description">My experience with ABC Company was very good and I recommend it to everyone. </span>
</div>
you take that code and take the parts you need to your webpage.
This video was great:
https://www.youtube.com/watch?v=N2PjWtybDOs
I have a site where Adblock Plus for Chrome is blocking links in H3 but not H2 elements. It seems strange I could just change them to H2 and it would work. But I have a lot of sites that have this potential issue. Is there a way way around that issue?
Why would H3 be an ad threat but not H2?
Here is some test code of this in action:
<div id="topCenterBlock">
<h3>A test headline </h3>
<div class="source">Stack Overflow</div>
<br>
<div class="source"> 2:30 P.M. ET </div>
<p>Test view of a extract from the article that would display under a link</p>
</div>
They would only be the default from install. I only installed the product so I could see the behavior, which one of our users complained about. I can get a snap later to show but it's just the set out of the box.
I've been working on a website locally, creating the web page using Dreamweaver and the latest version of Bootstrap (v 2.3.2). I've been testing it in different browsers and the images seem to load correctly in all of the other browsers (Chrome, Firefox, and Safari). When I go into Internet Explorer 8, some of the PNG files I created load correctly while others don't load at all.
Here is how it looks in Chrome:
Here is how it looks in IE8:
I read through many solutions. The first here, where I went into the Developer tool and did an image report. In the report, as seen below, shows it can read the ALT tags but can't seem to read or think the image link is broken:
Knowing this, I tried finding a more in-dept solution, including this post. Thinking it could possibly be the way the picture was created, I tried multiple ways of creating the images (including changing the format of the file to RGB 8-bit in Photoshop and copying/pasting the vector images from Illustrator to Photoshop) and then removing the browser cache every time I would modify the images and restart the browser. None of it seems to work!
I was wondering if there was something else I could possibly try?
The code I'm currently inserting these images are through the HTML:
<div class="span4">
<div id="applicationInfo">
<p>Application #:<br />
PI: <br />
Status: <br />
Disposition:
</p>
</div>
<ul>
<li>PI / CoPI Information<img src="images/incomplete.png" /></li>
<li>Project Information</li>
<li>Funding Information</li>
<li>Proposal Summary<img src="images/complete.png" /></li>
<li>Proposal Narrative</li>
<li class="current">Current Research Summary<img src="images/complete.png" /></li>
<li>Budget</li>
<li>Publications List</li>
<li>Supplemental Information</li>
<li>Save <span class="small">(without submitting)</span></li>
<li>Submit</li>
</ul>
</div>
This post helped a lot! What helped was making sure to have the images saved as RGB 8-bit or 16-bit. I usually have it defaulted at 16-bit to give more color.
Best of luck to anyone looking for this answer!