0

我想在 if 查询中检查特定字符串 (WBT) 是否出现在字符串中并对其进行响应。我知道可以在 Smarty 模板中使用正则表达式,但文档中的建议并不清楚。

这是我需要正则表达式来检查字符串 WBT 是否出现在其中的代码:

<div class="card-content" style="text-align: center;">
   [{if $woche.lehrskript}] // Check if "WBT" occurs in the string lehrskript
     <strong>WBT</string>
   [{else}]
     <strong>[{$woche.lehrskript.name}]</strong>
   [{/if}]
</div>

有人能帮助我吗?

4

1 回答 1

0

我已经这样解决了:

[{if strpos($woche.lehrskript.name, 'WBT') != false}]
于 2017-10-19T13:48:29.207 回答