简体   繁体   中英

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. 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>

Sample Text

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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