根据额外字段值0/1向k2页添加代码

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了根据额外字段值0/1向k2页添加代码相关的知识,希望对你有一定的参考价值。

  1. <?php /* we're using php comments to make sure it is commented completely! this is the code snippet to assign the extra fields array to the variable called $custom */ ?>
  2.  
  3. <?php $custom = $this->item->extra_fields; ?>
  4.  
  5. <?php /* this is the if statement to show a block of code only if the first custom field is not empty */ ?>
  6.  
  7. <?php if(!empty($custom[0]->value)):?>
  8.  
  9. This is the code or text to show only if the first custom field is not empty. To actually output the field in here, you would add it like this:
  10.  
  11. <?php echo $custom[0]->value;?>
  12. <?php endif;?>
  13.  
  14. <?php /* to make this work for any other field, just change the number in the [square brackets]. the first field in the group is 0, second is 1, third is 2, etc. */ ?>

以上是关于根据额外字段值0/1向k2页添加代码的主要内容,如果未能解决你的问题,请参考以下文章

K2 (Joomla) 的多个额外字段组

在 Joomla K2 中更改图像重命名

向 VBA 代码添加条件并重新查询

PySpark 根据第二个 DataFrame 的列向一个 DataFrame 添加值

Joomla! K2 - K2 类别的额外字段

根据 WooCommerce 中的自定义字段值将文本添加到订单摘要