Categories > TinyButStrong general >

[BUG] friend2=a converts "[" into its html-code

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: PsiTrax
Date: 2004-05-01
Time: 15:51

[BUG] friend2=a converts "[" into its html-code

Hi,
my Code:
<a href="index.php?file=[var.nextpic;friend2=a;htmlconv=no]">
<img src="[var.pic;onformat=check_size]" border="3">
</a>

gets after merge into

<img src="&#91;var.pic;onformat=check_size]" border="3">

and then TBS dont interpret the var.pic
By: RwD
Date: 2004-05-01
Time: 21:51

Re: [BUG] friend2=a converts "[" into its html-code

can you show the php code for that?
By: PsiTrax
Date: 2004-05-02
Time: 00:18

Re: [BUG] friend2=a converts "[" into its html-code

shure, its very easy
  $pic = $files[$_GET["file"]];
  $nextpic = $_GET["file"] + 1;
  $nextfile = $files[$nextpic];
  if(empty($files[$nextpic])) $nextpic = "";
By: PsiTrax
Date: 2004-05-02
Time: 22:06

Re: [BUG] friend2=a converts "[" into its html-code

Next Big-Problem
wanna output a JavaScript Array

HTML:
[var.js_preis_array;htmlconv=no]

PHP:
while ($erg = mysql_fetch_assoc($qerg)):
  $js_preis_array .= "var preise[".$erg["ID"]."][0] = ".$erg["Preis"].";\n";
  $js_preis_array .= "var preise[".$erg["ID"]."][1] = ".$erg["req"].";\n";
endwhile;

the Result:
var preise&#91;1]&#91;0] = 1.00;
var preise&#91;1]&#91;1] = 0;
var preise&#91;2]&#91;0] = 0.00;
var preise&#91;2]&#91;1] = 1;

Only the "[" char gets converted into its HTML code and this is very bad!

do anyone know about this? what can i do?
By: RwD
Date: 2004-05-02
Time: 23:35

Re: [BUG] friend2=a converts "[" into its html-code

Seems like a real bug, but this is a workaround for you:

PHP
while ($erg = mysql_fetch_assoc($qerg)):
  // keep vars
  $temp["ID"]         = $erg["ID"];
  $temp["Preis"]     = $erg["Preis"];
  $temp["req"]         = $erg["req"];
 
  // I do it this way so I do not need to keep a loop variable,
  // but just push in the temp array at the highest poition in the array + 1
  $test[]         = $temp;
 
  //**
  //* oer alternatively do this directly:
  //$test[]     = $erg;
endwhile;

$js_preis_array  = "var preise[1][0] = 1.00;\n";
$js_preis_array .= "var preise[1][1] = 0;\n";
$js_preis_array .= "var preise[2][0] = 0.00;\n";
$js_preis_array .= "var preise[2][1] = 1;\n";

// tbs code
$tbs->LoadTemplate('test.htm') ;
$tbs->MergeBlock( 'blk1', $test ) ;
$tbs->Show();

HTML
[var.js_preis_array;htmlconv=no]

[blk1;block=begin]
var preise[[blk1.ID]][0] = [blk1.Preis];
var preise[[blk1.ID]][1] = [blk1.req];
[blk1;block=end]

Haven't looked at your original problem yet...
By: RwD
Date: 2004-05-02
Time: 23:36

Re: [BUG] friend2=a converts "[" into its html-code

forgot to remove your original html code, but you'll understand I guess :)
By: RwD
Date: 2004-05-03
Time: 09:12

Re: [BUG] friend2=a converts "[" into its html-code

That is not the entire source for the php is it? I do not see the template being loaded
By: PsiTrax
Date: 2004-05-03
Time: 16:22

Re: [BUG] friend2=a converts "[" into its html-code

THX A LOT !!!

its works for the second problem
but for the main problem i'll work out a similar solution whith a block

btw: TBS is the best TPL-Engine ever seen!
By: RwD
Date: 2004-05-03
Time: 17:26

Re: [BUG] friend2=a converts "[" into its html-code

well, I think it doesn't get processed for some reason or another, try the mergespecial function for 'var' variables or else try it by MergeField...

Because if it is not a block, then use MergeField