Categories > TinyButStrong general >

unwanted <br /> being inserted

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: PhilE
Date: 2005-05-22
Time: 15:18

unwanted <br /> being inserted

g'day all,

I have a simple 3 column table displaying  name, phone and url.
If the url field, (3rd column) is empty, a <br /> tag is inserted after the first <td> tag of that row. If there is data in the url field, no <br /> tag is inserted. This means that rows end up different heights. There are no <br /> in either the htm or php files. Why is this tag being inserted, and how do I prevent it, if possible.

PhilE
By: Pirjo Posio
Date: 2005-05-22
Time: 20:51

Re: unwanted <br /> being inserted

Hi PhilE,

You gave no code here, so I make a partial model here:

...<td>[blk1.field3;.]</td>...

In the above code for the third <td> field there is a parameter dot. This parameter will give a non-breaking space &nbsp; if the data for field3 is empty. The dot is so invisible that many people don't see it easily.
By: PhilE
Date: 2005-05-23
Time: 00:37

Re: unwanted <br /> being inserted

Thanks for your suggestion, but I have tried that. It seems that if no url is found in the url field in the mysql table the <br /> is added. I have tried putting  just a zero in the url field in the mysql table and I still get a <br /> added in.

The code is just a mod of one of the examples.


This is the php code

$TBS = new clsTinyButStrong ;
$TBS->LoadTemplate('fielddays_datamysql.htm') ;
$RecCnt = $TBS->MergeBlock('blk1',$cnx_id,'SELECT name, phone, url FROM exhibitors',$PageSize,$PageNum,$RecCnt) ;

This is the html code

<td>
    [blk1.name;block=tr]
    </td>
  <td>
   <div align="right">[blk1.phone;.]</div>
  </td>
  <td>
   <div align="center"><a href ="[blk1.url]">[blk1.url;.]</a></div>
  </td>

and this is the resulting source code

<tr>
  <td>
    <br />
Auzbuilt/Australis Containers
    </td>
  <td>
   <div align="right">5623 2795</div>
  </td>
  <td>
   <div align="center"><a href ="">&nbsp;</a></div>

  </td>
</tr><tr>
  <td>
    Elgas Ltd
    </td>
  <td>
   <div align="right">5152 5253</div>
  </td>
  <td>
   <div align="center"><a href =http://www.elgas.com.au>http://www.elgas.com.au</a></div>

  </td>
</tr>

Note the <br /> tag in the row without the url. I have tried it without any styles, with and without the parameter dot. I have tried setting a line height, adding in my own <br /> tag.

I'm just trying TBS out, so am still exploring all the in and outs. I'm sure its a simple error on my part, I just can't see where.
By: PhilE
Date: 2005-05-23
Time: 01:25

Re: unwanted <br /> being inserted

by the way, the only place I can find a <br /> in tbs_class.php is in the error message section, line 2143 or thereabouts. I tried removing them but that made no difference either.

PhilE
By: Skrol29
Date: 2005-05-23
Time: 02:33

Re: unwanted <br /> being inserted

Hi,

It seems that the break line comes from the value of the field.
You can check that by adding parameter 'htmlconv=nobr" in the blk1.name tag.
If the br comes from the value of the fields, then it will be no longer displayed using this parameter.
By: PhilE
Date: 2005-05-23
Time: 03:34

Re: unwanted <br /> being inserted

thanks Skrol, that's fixed it. I'm not sure I understand why, but it works like I wanted it to now.

PhilE
By: Skrol29
Date: 2005-05-23
Time: 11:49

Re: unwanted <br /> being inserted

Your data has a new line character at the beginning.
By: PhilE
Date: 2005-05-23
Time: 12:22

Re: unwanted <br /> being inserted

ok, I don't know how they got there, but that could explain some other funny behaviour, such as an alphabetical sort giving me two groups, with those records containing an url sorted separately at the end of the list. An update of the record must remove the offending character. I will now see if I can figure out how to get rid of them without doing an edit save on every record.
Thank you so much for your assistance with my problem.

PhilE