Categories > TinyButStrong general >

block and conditional display

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Peter Schade
Date: 2006-03-29
Time: 15:42

block and conditional display

ich have an serial-block html like this:
[bookfriends_1.name][bookfriends_1.owner;if [val]==1;then '<br>Eigentuemer']
[bookfriends_2.name][bookfriends_2.owner;if [val]==1;then '<br>Eigentuemer']
[bookfriends_3.name][bookfriends_3.owner;if [val]==1;then '<br>Eigentuemer']
and merge this with mergeblock ... but it seems that the conditional display is not merged.

Is it not possible in blocks?

Bye Peter
By: Skrol29
Date: 2006-03-29
Time: 15:50

Re: block and conditional display

Hello Peter,

Could you precise what happens?
Your 'if' statement seems ok.
By: Peter Schade
Date: 2006-03-29
Time: 16:26

Re: block and conditional display

i have two owner wich set to 0 and one to 1, but it prints always "<br>Eigentuemer" :( I think i am oversee something.
The array wich i merge has the correct values, but it seems that my TBS tags in the HTML not correct...

The values are defined as :
$werte['owner'] = 0;
or
$werte['owner'] = 1;

All the other tags display properly, also when i write
[bookfriends_3.owner] the values merged correct.

I really don't know where my mistake is.

Bye Peter
By: Skrol29
Date: 2006-03-29
Time: 16:34

Re: block and conditional display

Could you check if there is no text line breaks inside the TBS tag. (<br> is ok, but not "\r\n").

Could you also verify the assumed values by displaying them without conditional display.
Like:
{[bookfriends_1.owner]}
{[bookfriends_2.owner]}
{[bookfriends_3.owner]}
I suggest you place them betweens {} in order to see blank charaters and line breaks.
By: Peter Schade
Date: 2006-03-29
Time: 17:04

Re: block and conditional display

i tried this short code for testing and here is all ok, i think i have an problem in my big template :( I will try to find out what this causes. BTW Is there an way to make the if's \n\r compatible? Dreamweaver makes me wild when he break the line so often.
<?php
$html = "
<table>
  <tr>
    <td>[bookfriends;block=tr;serial][bookfriends_1.nickname;block=td][bookfriends_1.owner][bookfriends_1.owner;if [val]==1;then '<br> Eigentümer']</td>
    <td>[bookfriends_2.nickname;block=td;.][bookfriends_2.owner][bookfriends_2.owner;if [val]==1;then '<br> Eigentümer']</td>
    <td>[bookfriends_3.nickname;block=td;.][bookfriends_3.owner][bookfriends_3.owner;if [val]==1;then '<br> Eigentümer']</td>
    <td>[bookfriends_4.nickname;block=td;.][bookfriends_4.owner;if [val]=1;then '<br> Eigentümer']</td>
  </tr>
</table>
";
require_once('class_template-engine.php');
$TBS = new clsTinyButStrong ;
$TBS->Source = $html;
$buecher[] = array('nickname' => 'test1 ', 'owner' => 0);
$buecher[] = array('nickname' => 'test2 ', 'owner' => 1);
$buecher[] = array('nickname' => 'test2 ', 'owner' => 1);
$TBS->MergeBlock('bookfriends', $buecher);
$TBS->Show();
?>
By: Skrol29
Date: 2006-03-29
Time: 17:24

Re: block and conditional display

> Is there an way to make the if's \n\r compatible?

Not whithout coding.
This could be a nice enhancement, but I have to figure out before if this cannot make any trouble in building a template.
By: Peter Schade
Date: 2006-03-31
Time: 10:50

Re: block and conditional display

yet i know the problem, it was an previous if like this:

[test;if [val]=1;then '
some tables....
[bookfriends_4.owner;if [val]=1;then '<br> Eigentümer']
']

so the [val] get never the correct value. Is that desired or an bug?
By: Skrol29
Date: 2006-03-31
Time: 11:14

Re: block and conditional display

Ig [test] is merged before [bookfriens] then it has a definition with bad string deltimitors. Someting like :
[test;...;then 'xxx'yyy'zzz']]
While it should be:
[test;...;then 'xxx''yyy''zzz']]
By: Peter Schade
Date: 2006-03-31
Time: 11:54

Re: block and conditional display

ah yes i forgot the delimiters.

Thank you for your help
Bye Peter