2
我必須從我的WP網站的產品詳細信息頁面創建PDF文檔,並從頁面中提取所有HTML代碼以推斷img和表格標籤。 我安裝了一個插件來從頁面創建一個PDF文檔,但是imagese和表格沒有被插入:只有文本被插入到文檔中。從PHP頁面中提取HTML代碼以推斷一些圖像
該插件是woocommercePrintProduct,我已經編輯了它的代碼以將圖像插入到PDF文檔中。應當修改的功能如下:
div class="descrizione" style="margin:0 30px;">
<div class="colonnaSx" style="float:left;width:350px;margin-right:30px">
<div class="pacchettino">
<?php if(get_field('descrizione_prod')): ?>
<h3>DESCRIPTION</h3>
<p><?php the_field('descrizione_prod'); ?></p>
<?php endif; ?>
</div>
<div class="pacchettino">
<?php if(get_field('forma')): ?>
<h3>SHAPE</h3>
<p><?php the_field('forma'); ?></p>
<?php endif; ?>
</div>
<div class="pacchettino">
<?php if(get_field('posa')): ?>
<h3>INSTALLATION</h3>
<p><?php the_field('posa'); ?></p>
<?php endif; ?>
</div>
<div class="pacchettino">
<?php if(get_field('conduttore')): ?>
<h3>CONDUCTOR</h3>
<p><?php the_field('conduttore'); ?></p>
<?php endif; ?>
</div>
<div class="pacchettino">
<?php if(get_field('isolante')): ?>
<h3>INSULATION</h3>
<p><?php the_field('isolante'); ?></p>
<?php endif; ?>
</div>
<div class="pacchettino">
<?php if(get_field('guaina')): ?>
<h3>SHEAT</h3>
<p><?php the_field('guaina'); ?></p>
<?php endif; ?>
</div>
<div class="pacchettino">
<?php if(get_field('sforzo_massimo_di_tiro')): ?>
<h3>MAX MECHANICAL STRESS</h3>
<p><?php the_field('sforzo_massimo_di_tiro'); ?></p>
<?php endif; ?>
</div>
<div class="pacchettino">
<?php if(get_field('guainetta')): ?>
<h3>INTERNAL SHEATH</h3>
<p><?php the_field('guainetta'); ?></p>
<?php endif; ?>
</div>
</div>
<div class="colonnaDx" style="float:right;width:350px;">
<div class="pacchettino">
<?php if(get_field('marchiatura')): ?>
<h3>MARCHIATURA</h3>
<p><?php the_field('marchiatura'); ?></p>
<?php endif; ?>
</div>
<div class="pacchettino">
<?php if(get_field('colore')): ?>
<h3>COLORE</h3>
<p><?php the_field('colore'); ?></p>
<?php endif; ?>
</div>
<div class="pacchettino">
<?php if(get_field('tensione_di_esercizio')): ?>
<h3>TENSIONE DI ESERCIZIO</h3>
<p><?php the_field('tensione_di_esercizio'); ?></p>
<?php endif; ?>
</div>
<?php /*
<table class="description">
<?php
$description = wpautop($this->data->description);
$description = preg_replace("/\[[^\]]+\]/", '', $description);
$description = explode('<p>', $description);
foreach ($description as $value) {
?>
<tr>
<td style="padding-bottom: 20px;">
<?php echo $value ?>
</td>
</tr>
<?php
}
?>
</table>
*/
?>
<div class="description" style="margin:0 30px;">
<?php
$description = wpautop($this->data->description);
$description = preg_replace("/\[[^\]]+\]/", '', $description);
$description = explode('<p>', $description);
foreach ($description as $value) {
?>
<div class="pacchettino" style="padding-bottom: 20px;margin:0 30px;">
<?php
echo $value
?>
</div>
<?php
}
?>
</div>
<?php
return ob_get_clean();
}
我想提取從細節產品頁面的html代碼,然後推斷img標籤和intert他們到文檔中。
你能幫助我嗎?
插件的名稱是什麼? –
插件是woocommercePrintProduct,我編輯了它的代碼以在PDF文檔中插入圖像 –