Categories > TinyButStrong general >

Sub-block Issue

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Scythe
Date: 2006-12-06
Time: 06:22

Sub-block Issue

Hi Skrol,

Love the new changes to TBS.  I have one issue when implementing the sub-block for use on a page.  Here's the HTML code:

<span>
<a href="[urls.url;block=span;p1=[items.$]]">
[urls.name;block=span;magnet=span]
</a>[onshow;if '[urls.$]' -+ '[urls.#]'; then ',&nbsp;'; else '&nbsp;']
</span>

"urls" is a subblock.  Now, what I want it to do is to add a comma after all the url's in this block list except the last one.  However, the issue I have is that there's no way of determining the end of the array within the template since it's a sub-block and can be unlimited or none at all.  Is there anyway of determining [urls.$] + 1, or simply [urls.#] - 1???

Any help would be great, thanks!
By: Skrol29
Date: 2006-12-06
Time: 16:33

Re: Sub-block Issue

Hi,

There is no way to determine the next of the last value for [urls.$] or [urls.#]. TBS merges rows one by one, without looking what comes after.

But the good new is that a splitter section can probably do what you're trying to do. A splitter section is defined by parameter "splittergrp".
It could be something like this:
<a href="[urls.url;block=a;p1=[items.$]]">[urls.name;magnet=a]</a>
[urls;block=begin;splittergrp=url],[urls;block=end]

[urls.#] is the row number when placed inside the block,
It is the total number of rows when placed outside the block.

[urls.$] is the row id. It is the item key when the data source is an array.