conbask
conbask

Reputation: 10061

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?

Upvotes: 0

Views: 108

Answers (1)

Chris Baker
Chris Baker

Reputation: 50592

EDIT Another shot:

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

Upvotes: 1

Related Questions