dongying195959 2019-02-14 11:46
浏览 35

Emogrifier删除页面上的所有内容

I'm trying make Emogrifier work with my page, but as I'm new to Emogrifier I'm having a hard time making it work properly. I followed the github documentation, but was unsure as of how to execute and use it, so I simply inserted the given code into my .php file:

<?php 
$html = '<button id="updatecv" name="updatecv" class="cvupdater">Opdater CV</button>';
$css = 'cvupdater {margin-left:auto;margin-right:auto;margin-bottom:20px;display:block;width:150px;}';
$emogrifier = new \Pelago\Emogrifier($html, $css);

?>

<?php
try {
    require "config.php";
    require "common.php";
    $id = $_GET['cvid'];
    $connection = new PDO($dsn, $username, $password, $options);
    $sql = "SELECT * FROM cvs WHERE id = :cvid";
    $statement = $connection->prepare($sql);
    $statement->bindParam(':cvid', $id, PDO::PARAM_STR);
    $statement->execute();
    $result = $statement->fetchAll();
}
catch(PDOException $error) {
    echo $sql . "<br>" . $error->getMessage();
}
?>

<?php include "header.php"; ?>

<p class="hidden" id="hiddencvid"><?php echo $id ?></p>



<button id="updatecv" name="updatecv" class="cvupdater">Opdater CV</button>
<p class="cvupdater" style="width:500px;">Tryk på tekst for at redigere. Tryk på "Opdater CV" for at gemme ændringer.</p>

<a href="index.php">Hjem</a>

<div class="cvpreview">

<?php foreach($result as $row) { ?>


<div class="cvheader">
  <div id="img-wrapper">
    <img src="uploads/<?php echo escape($row["cvid"]) . ".png" ?>" alt="profile_picture">
  </div>
  <h1><?php echo escape($row["fullname"])?></h1>
  <div contenteditable class="cvheader-worktitle" id="worktitle"><?php $decodedworktitle = html_entity_decode($row["worktitle"]); echo $decodedworktitle?></div>
</div>

<hr>

<div class="cvbody">
    <div class="leftcolumn">
      <div class="profil columnboxleft">
        <h5>Profil</h5>
        <div contenteditable class="cvtext" id="profiledesc"><?php $decodedprofiledesc = html_entity_decode($row["profiledesc"]); echo $decodedprofiledesc?></div>
      </div>   
      <div class="workexperience columnboxleft">
        <h5>Arbejdserfaring</h5>  
        <div contenteditable class="cvtext" id="workexperience"><?php $decodedworkexperience = html_entity_decode($row["workexperience"]); echo $decodedworkexperience?></div>  
      </div>
      <div class="education columnboxleft">
        <h5>Uddannelse</h5>
        <div contenteditable class="cvtext" id="education"><?php $decodededucation = html_entity_decode($row["education"]); echo $decodededucation?></div>  
      </div>
    </div>

    <div class="rightcolumn">
      <div class="details columnboxright">
        <h5>Detaljer</h5>
        <div contenteditable class="cvtext" id="phonenumber"><?php $decodedphonenumber = html_entity_decode($row["phonenumber"]); echo $decodedphonenumber?></div>
        <div contenteditable class="cvtext" id="email"><?php $decodedemail = html_entity_decode($row["email"]); echo $decodedemail?></div>
        <div contenteditable class="cvtext" id="birthdate"><?php $decodedbirthdate = html_entity_decode($row["birthdate"]); echo $decodedbirthdate?></div>
      </div>
      <div class="skills columnboxright">
        <h5>Evner</h5>
        <div contenteditable class="cvtext" id="skills"><?php $decodedskills = html_entity_decode($row["skills"]); echo $decodedskills?></div>
      </div>
      <div class="languages columnboxright">
        <h5>Sprog</h5>
        <div contenteditable class="cvtext" id="languages"><?php $decodedlanguages = html_entity_decode($row["languages"]); echo $decodedlanguages?></div>
      </div>
    </div>
<?php } ?>
</div>

</div>
<?php include "footer.php"; ?>

However, where ever I insert the emogrifier code, the content following that snippet gets completely removed from my page.

Placing the snippet at the bottom of the file does make the page render, but the function of emogrifier doesn't seem to apply.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 有了解d3和topogram.js库的吗?有偿请教
    • ¥100 任意维数的K均值聚类
    • ¥15 stamps做sbas-insar,时序沉降图怎么画
    • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
    • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
    • ¥15 关于#Java#的问题,如何解决?
    • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
    • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
    • ¥15 cmd cl 0x000007b
    • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line