|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
sarahfoxnz Smarty Regular
Joined: 11 Apr 2010 Posts: 76
|
Posted: Sat Jan 08, 2022 5:27 am Post subject: BLOCK or modifier - suggestions |
|
|
Hello.
i post on redit but see very few replies (if any) - isa nyone using it ?
i have the following code -
{if isset($v12.word)}{if $v12.word|@count >0}{assign var="word" value=1}{/if}{/if}
However it seems to be a bit long and i have about 50+ variables/names to check.
I was wondering how to convert this into a block.
EG:-
{block}WORD NAME{/block}
- check if array $v12.word exists.
-if it does and has 1 or more values set - then assign the value to $word as 1
- otherwise assign it to $word = 0
Ive done 1-2 blocks before, however i'm not sure how to send the value of $v12.word to the block script.
OF COURSE I want to avoid any errors - eg $v12.word doesnt exist while its sending it tothe script..
in the meantime, I'll do it the long-way..
PS this is in a foreach loop of 60+ data entries and 40-50 names to check.
i could do it in my php script to assign 40-50 '0' values to each expected result, but that will expand my array to 1,000= entries that aren't needed. |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|