简体   繁体   English

Cakephp - 如何在输出中添加删除线

[英]Cakephp - how to add strikethrough to output

I have the output <td><?= h($book->price) ?></td> now i'd like to add a strikethrough tag to the output if $book->sales_price is not null. 我有输出<td><?= h($book->price) ?></td>现在如果$book->sales_price不为null,我想在输出中添加删除标记。 How would I add the code for strikethrough? 我如何添加删除线的代码?

if($book->sales_price){
//add strikethrough
}

Thank you very much! 非常感谢你!

Use the strike through tag <s> Sample Text </s> or <strike> Sample Text </strike> 使用删除标记<s> Sample Text </s><strike> Sample Text </strike>

Sample Text 示范文本

if(is_null($book->sales_price)) {
  <td><?= h($book->price) ?></td>
} else {
  <td><s><?= h($book->price) ?></s></td>
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM