Categories > TinyButStrong general >

tbs creates a syntax like '<opt<option>'

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Olifants
Date: 2007-06-09
Time: 18:08

tbs creates a syntax like '<opt<option>'

Hello!

I've problems with sub-blocks and creating select-option-list-menues.
In the lines with the '?' the 'select name=' and the 'id=' are missing
and in the line with the '??' there is a syntax like this: '<opt<option>'
and the first entry 'All TestB' is missing in the browsers output list menue.

What I only want to do is to create a couple of select lists to learn the how to.

Here is what I've done and was is happening:


--- php file ---

$itemArea[$i] = array('itemLabel' => $itemLabel, 'selectedItem' => $selectedItem);
$itemArea[$i]['item'][] = array('itemId' => $itemId, 'itemValue' => $defaultItem);

$Nbr = $tmpl->MergeBlock('showItemLabel','array','itemArea') ;
if ($Nbr > 0) $tmpl->MergeBlock('showItem','array','itemArea[%p1%][item]') ;

$tmpl->Show(TBS_OUTPUT);

--- html file ---

<table width="400" border="1" align="center" cellpadding="4" cellspacing="0" bordercolor="#3399CC">
  <td>[var.searchFormLabel;magnet=table]<br><br>
   <tr>
    <td>[showItemLabel.itemLabel;block=tr]<br><br>
      <table border="1" align="center" cellpadding="2" cellspacing="0">
        <tr bgcolor="#F0F0F0">
          <td>
              <select name="[showItem.itemId]" class="normal" id="[showItem.itemId]">
                  <option value="[showItem.itemValue]">[showItem.itemValue;block=option;p1=[showItemLabel.$]]</option>
                  <option>[showItemLabel.selectedItem;ope=html;select]</option>
              </select>
           </td>
        </tr>
      </table>
    </td>
   </tr>
  </td>
</table>


--- html-output ---

<table width="400" border="1" align="center" cellpadding="4" cellspacing="0" bordercolor="#3399CC">
  <td>title 1<br><br>
   <tr>
    <td>subtitle 1<br><br>
      <table border="1" align="center" cellpadding="2" cellspacing="0">
        <tr bgcolor="#F0F0F0">
          <td>
?              <select name="" class="normal" id="">
                  <option>All TestA</option>
                  <option>test1</option>
                  <option>test2</option>
                  <option>test3</option>
                  <option>test4</option>
              </select>
          </td>
        </tr>
      </table>
    </td>
   </tr><tr>
    <td>subtitle 2<br>
      <br>
      <table border="1" align="center" cellpadding="2" cellspacing="0">
        <tr bgcolor="#F0F0F0">
          <td>
?              <select name="" class="normal" id="">
??                  <opt<option>All testB</option>
                  <option>next1</option>
                  <option>next2</option>
                  <option>next3</option>
            </select>
          </td>
        </tr>
      </table>
    </td>
   </tr>
  </td>
</table>



Thanks for help

Ronny
By: Skrol29
Date: 2007-06-10
Time: 02:39

Re: tbs creates a syntax like '<opt<option>'

Hello Ronny,

Thank you for your reporting on this bug with useful details.
I've reproduce the bug, it is a TBS that occurs in special cases :
- when you merge a block with parameter p1 (sub-block)
and
- when some fields of the block are put outside the block.
It has nothing to do with the HTML plug-in.

In your snippet, you have some "showItem" fields outside the "showItem" block. This is allowed for templates,  TBS should be able to manage this.
But there is a bug. I'll publish a fix soon, but you can fix it right now by changing the line :
   $Delta = $Pos - $OldEnd;
with:
   $Delta = $Pos - $OldEnd-1;
(in the TBS file)


Nevertheless your snippet has a mistake:
You do MergeBlock('showItemLabel') before MergeBlock('showItem') so the field [showItemLabel.selectedItem;ope=html;select] cannot select the correct value because those values are marged after, by 'showItem'.

Regards,
By: Olifants
Date: 2007-06-11
Time: 11:48

Re: tbs creates a syntax like '<opt<option>'

Thanks for helping.

I fixed my TBS file and now it works for every entry. For the selected item I have to look and find a solution.

Nice day