Categories > TinyButStrong general >

Dynamic block issues on a TinyButStrong based website

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Denis Ogun
Date: 2008-07-17
Time: 12:07

Dynamic block issues on a TinyButStrong based website

Hi, I am currently using PHPmotion which runs on the TinyButStrong engine.
http://pwn-tube.com/gaming-movies/play.php?vid=472

At the moment it looks like this, but if you compare it to my current default template, it shows that not all comments have boxes.

http://pwn-tube.com/play.php?vid=472

This is my code, if you guys could help it would be much appreciated.

<div class="comments">
        <span class="left">
            <img class="profile_image" src="[blk3.poster_picture;block=div;comm]" alt="Member Thumbnail" width="50" height="50" />
                    </span>
                <h1>
            <!--[blk3.by_username;block=((div));comm]--> says:
            [onload_1;block=div;when [var.show_comments]=1]
            <br />
             <!--[blk3.comments;block=((div));comm]-->
            </h1>
        </div>
HTML

.comments {
    width: 540px;
    height: 98px;
    background-color: #323232;
    border: 1px solid #030303;
    float: left;
    margin-top: 19px;
}
   
.comments h1 {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    font-style: normal;
    font-weight: bold;
    text-decoration: none;
    color: #FFFFFF;
    padding: 0;
    margin-top: 23px;
    margin-left: 79px;
}

.comments p {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 11px;
    font-style: normal;
    font-weight: normal;
    text-decoration: none;
    color: #FFFFFF;
    padding: 0;
    margin-top: 23px;
    margin-left: 79px;
}

.profile_image {
    border: 1px #09529A solid;
    height: 50px;
    width: 50px;
    margin-top: 18px;
    margin-left: 13px;
}

CSS

$text = $result1['comments'];
    $wrap = wordwrap($text, $wrap_limit, " ", true);
    $each_comment = array(
        'poster_picture'=>$a1_mypicture, 'by_username' =>
        $member_user_name, 'comments' => $wrap,);
    $result_search3[] = $each_comment;


and

$template = "../templates/main_1.htm";
$inner_template1 = "../templates/inner_play.htm";//middle of page
$TBS = new clsTinyButStrong;
$TBS->NoErr = true;// no more error message displayed.
$TBS->LoadTemplate("$template");
$TBS->MergeBlock('blk1', $result_search);
$TBS->MergeBlock('blk2', $result_search2);
$TBS->MergeBlock('blk3', $result_search3);
$TBS->Render = TBS_OUTPUT;
$TBS->Show();

PHP

Thanks
Denis Ogun
By: Skrol29
Date: 2008-07-17
Time: 23:44

Re: Dynamic block issues on a TinyButStrong based website

Hi Denis,

I didn't knew that PHPmotion was using TBS. What a nice news :)

Here are my remarks about your template:

a) You should replace
  [blk3.poster_picture;block=div;comm]
with
  [blk3.poster_picture;block=div]
because this TBS field is not embedded inside an HTML comment tag (ie: <!-- ... -->)

b) replace
  [blk3.by_username;block=((div));comm]
with
  <!--[blk3.by_username;comm]-->
There is no need the repeat the block definition for each fields. Only one is enough. The other ones are ignored.

c) same thing for
  <!--[blk3.comments;block=((div));comm]-->

d) the field
  [onload_1;block=div;when [var.show_comments]=1]
is good to delete the block if $show_comments is equal to 1.
But you should think to also not merge "blk3" in this case. If you code MergeBlock('blk3',...) then TBS will found no block, then it will merge nothing, so it won't make any error, but it's cleaner to not do the merging.




I hope this helps,
Regards,