简体   繁体   中英

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

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)}

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