Categories > TinyButStrong general >

Problem with TBS or bug in TBS

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: ClausVB
Date: 2005-09-01
Time: 14:25

Problem with TBS or bug in TBS

Hi there!

I am working on a complicated template (with many tables) and found out that HTML-code is ignored by TBS.

I wrote a short example to reproduce the problem. If you want to see the full code I can post it here or on my webspace.

Code:
PHP: http://lamp.clausvb.de/tbs_examples/gruppenwechsel_tmpl.php
script: http://lamp.clausvb.de/tbs_examples/gruppenwechsel_tmpl.php?showsource=1
template: http://lamp.clausvb.de/tbs_examples/gruppenwechsel_tmpl.php?showsource=2

Problem:
As you can see "<h2>Hello World</h2>" (template) and the comment are totally ignored. I think I know why: It is not in a block. Is this a bug? Other template engines have no problems with this kind of HTML-code. I tried 2 different examples (http://www.tinybutstrong.com/examples.php):
- Sub-blocks
- Conditional display
- Groupings (headers, ...)

I could create a DIV around it, but I do not want to. Is there any other solution?

Thanks in advance!

Regards,
Claus
By: Skrol29
Date: 2005-09-01
Time: 14:39

Re: Problem with TBS or bug in TBS

Hi Claus,

This behavior is normal for TBS.
Your block has several sections (one header and one normal section), and all that is bewteens section definitions of a same block is deleted.

It can be surprising, but in an other hand, what TBS is supposed to logically do with that piece of code ?

If you'd like to have your <h2> text in the header, then you have to extend the header section using parameter "extend".
By: ClausVB
Date: 2005-09-01
Time: 19:18

Re: Problem with TBS or bug in TBS

Thanks for you quick response!

It works with the <h2> tag, but not with the comment:
<!-- This is an important note -->

It solved my problem with my complicated table design, but now data from the sub-blocks is missing:

<td width="100%" align="left" nowrap="nowrap"><a href="show_category.php?c=1">[table_data.c_name;block=table;headergrp=c_name;extend=2]</a></td>

<!-- content -->
<table width="100%" class="forumline" cellpadding="2" cellspacing="1">
   <tr>
      <th colspan="2" height="25" nowrap="nowrap">&nbsp;Files&nbsp;</th>
      <th nowrap="nowrap">&nbsp;Downloads&nbsp;</th>
      <th nowrap="nowrap">&nbsp;Comments&nbsp;</th>
      <th nowrap="nowrap">&nbsp;Last Comment&nbsp;</th>
   </tr>
   <tr>
      <td class="row4" align="center" valign="middle" width="30" height="30"><img src="skins/MorpheusXSteelBlue/folder_big.gif" width="28" height="32" alt="No new posts" title="No new posts" /></td>
      <td class="row1h" width="70%"><a class="forumlink" href="#">[table_data.f_name;block=tr]</a><br />
        <span class="genmed">[table_data.f_short_description;block=tr]</span>
      </td>
      <td class="row2" align="center" valign="middle">--</td>
      <td class="row2" align="center" valign="middle">--</td>
      <td class="row3" align="center" valign="middle" width="130">--</td>
   </tr>
</table>

If I delete "extend=2" all data is displayed again.

If you need the whole template, with PHP script I will post them tomorrow on my webspace.

Best regards,
Claus
By: Skrol29
Date: 2005-09-02
Time: 10:13

Re: Problem with TBS or bug in TBS

Hello,
Could you provide more details.
I think I don't understand your problem.
Your links were very useful to help on your template.
By: ClausVB
Date: 2005-09-02
Time: 13:14

Re: Problem with TBS or bug in TBS

The first one looks perfect, but data (files) is missing:
http://dl.clausvb.de/home.php
http://dl.clausvb.de/home.php?showsource=1
http://dl.clausvb.de/home.php?showsource=2

The second one uses SPAN to create an artifical block. All data is displayed, but I do not want to use SPAN that way:

http://dl.clausvb.de/home_working_with_span.php
http://dl.clausvb.de/home_working_with_span.php?showsource=1
http://dl.clausvb.de/home_working_with_span.php?showsource=2

It is not valid XHTML this way:
<span>
<!-- header -->
<table width="100%" class="hdr" cellspacing="0" cellpadding="0">
(...)
   </tr>
</span>
  <tr>

Thanks and regards,
Claus
By: Skrol29
Date: 2005-09-02
Time: 22:07

Re: Problem with TBS or bug in TBS

Hi Clause,

I think you can do it with you first template, the one without <span>.
There is a problem I can see. The tag:
  [table_data.c_name;block=table;headergrp=c_name;extend=2]
Should be:
  [table_data.c_name;block=table;parentgrp=c_name;extend=2]

Parameter 'headergrp' is to define a section separated from other sections. 'parentgrp' is a special one that hallows you to put embedded sections (of the same block) inside. And that's just what you're doing.
Make that change and it should works as you expect.

Another point is that you've defined:
  [table_data.f_name;block=tr]
and:
  [table_data.f_short_description;block=tr]
in the same <tr>. A section of block needs only one parameter 'block' inside. The others are simply ignored. That does not change anything, but it's easier to write. Like:
  <tr>
  [table_data.f_name;block=tr]
  [table_data.f_short_description]
  </tr>

By: ClausVB
Date: 2005-09-03
Time: 22:09

Re: Problem with TBS or bug in TBS

Thanks for the support.

I made the changes:
http://dl.clausvb.de/home.php

It looks good, but not as I expect.

It should look like this:
http://dl.clausvb.de/home_correct.htm

I tried different combinations with
- parentgrp and
- headergrp
but I do not get it the way I need it. Perhaps I have to combine it with an IF structure like
[onload_1;block=tr;when [var.blk_id]=2]
and
[blk2.#]
so "extend=2" is only used once.

I am out of ideas, so I hope you will help me.

Thanks in advance!

Regards,
Claus
By: Skrol29
Date: 2005-09-03
Time: 23:09

Re: Problem with TBS or bug in TBS

Hi Claus,

I've tested your template with the same data as yours.
It works perfectly well for me.

Could you check your TBS version. Parameter 'parentgrp' appears with version 2.02. I've tried without parameter 'parentgrp' and I have the same result has yours.


By the way, may I suggest you a simplification for your script. I've seen the task that you've coded just before the MergeBlock() and which retrieve the data. This can be replaced with on command line :
mysql_db_open($db_host, $db_user, $db_pw, $db_name);

$tmpl->MergeBlock('table_data','mysql','SELECT f_id, f_category_id, f_name, f_short_description,c_name FROM dl_files AS f INNER JOIN  dl_categories AS c ON (f.f_category_id=c.c_id) ORDER BY f_category_id');

"see easy, so simple, so powerful"
By: ClausVB
Date: 2005-09-04
Time: 12:39

Re: Problem with TBS or bug in TBS

Problem solved. Thank you very much.

I updated it before I made my first post here, but I put the new "tbs_class.php" in the wrong directory. I am sorry for that.

And thanks very much for your help with MySQL "INNER JOIN" the script is easy to understand now.

Thank you very, very much.

Regards,
Claus

PS: I translated about 20% of your manual into german, but its more difficult than I thought, because a pure translation won't fit, since "merge" has different meanings in german. So I have to understand first how TBS works in a specific manner so I can translate it the right way.

I have to check which features changed from 2.01 to 2.05.

Take a look:
http://lamp.clausvb.de/tbs_mhtml/tbs_de_manual.htm

I will try to get it done this year. Perhaps we can put it on your site, when I have translated 50% or 60%. So german users can read the first chapters in german, which is enough to start with the basics.
By: Skrol29
Date: 2005-09-06
Time: 01:54

Re: Problem with TBS or bug in TBS

> PS: I translated about 20% of your manual into german

Wow! It should take long.
I've helped a lot for the manual translation. I can say it is a big work.
But you have to know that whe TBS chnaged, the manual has to be updated and this is a work too!

You can see the deferences between the two manuals using the Html version which has a a special button on the header.