By: Rune
Date: 2013-01-14
Time: 15:40
|
Array referencingIs there any way to do a direct array reference, like...
And then in the template, reference by array index, like...
To read the first item, etc... |
||
By: Sarah
Date: 2013-01-14
Time: 17:09
|
Re: Array referencingYour first code block looks right, but in the second one, you would need to define the block boundaries, I think. For example, if you wanted to print each element of $test in a <p> you would do:
And TBS would automatically create a <p> element for each item in your array, giving you:
For clarity's sake (at least), it is probably best to call your block something different than your array, e.g. 'block1'. In this case your merge would look like $TBS->MergeBlock('block1','array',$test) and your tag would look like [block1;block=p] There are other ways to define blocks if this simple way doesn't work for you, but you need your block boundaries defined to use MergeBlock. More info here: http://www.tinybutstrong.com/manual.php#html_block |
||
By: Rune
Date: 2013-01-15
Time: 10:25
|
Re: Array referencingYeh, I think I figured out where I went wrong. I am not trying to render the elements automatically, but individually reference an element by index. For example rendering only item 2 (b). Seems like its working if I assign the array with
and reference with
|