简体   繁体   English

Smarty PHP条件帮助

[英]Smarty PHP Conditional Help

When $SENDER_LAST_WORD_PLAYED or $SENDER_LAST_WORD_SCORE are blank I want the sentence stating "First word played: $SENDER_LAST_WORD_PLAYED for $SENDER_LAST_WORD_SCORE points" to not be printed. $SENDER_LAST_WORD_PLAYED$SENDER_LAST_WORD_SCORE为空白时,我希望不要打印这样的句子:“第一个演奏的单词:$ SENDER_LAST_WORD_PLAYED,代表$ SENDER_LAST_WORD_SCORE点”。 So far I've written it so that only if $SENDER_LAST_WORD_PLAYED is not present it will not print the sentence but i would also like to put $SENDER_LAST_WORD_SCORE validation on it. 到目前为止,我已经编写了它,以便仅当不存在$SENDER_LAST_WORD_PLAYED ,它才不会打印该句子,但是我也想$SENDER_LAST_WORD_SCORE进行$SENDER_LAST_WORD_SCORE验证。

Here's my code right now: 现在是我的代码:

{if isset($SENDER_LAST_WORD_PLAYED) && !empty($SENDER_LAST_WORD_PLAYED)}
First word played: '{$SENDER_LAST_WORD_PLAYED|truncate:15:"..."|capitalize}' for %%SENDER_LAST_WORD_SCORE%% points
{else} {/if}

Any ideas? 有任何想法吗?

编辑另一个镜头:

{if isset($SENDER_LAST_WORD_PLAYED) && !empty($SENDER_LAST_WORD_PLAYED) && isset(SENDER_LAST_WORD_SCORE) && !empty(SENDER_LAST_WORD_SCORE)}

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

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