Categories > TinyButStrong general >

Passing an array error if using formatted string

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Clod
Date: 2004-11-17
Time: 01:26

Passing an array error if using formatted string

Hi Skrol,

I'm a newbie and started to code using TBS however everytime i pass an array, error occurs.

e.g.

$myString[] = array('strVal1'=>'xxx','strVal2'=>'sss','strVal3'=>'yyy'); <<<this  array is fine.

$mString = "'strVal1'=>'xxx','strVal2'=>'sss','strVal3'=>'yyy'";
$myString[] = array($mString);<<<this returns error.

also, this happens using concatenated strings ...I don't know if i'm doing right, hope you can help me...thanks.

Btw, I have downloaded the manual and I'd like to create a PDF version of it using Adobe which I'd like to share.

Also, your TBS system always works like a charm...more power!!! ;-)


Thanks a lot...
`` .:clod:.``
By: Skrol29
Date: 2004-11-17
Time: 01:47

Re: Passing an array error if using formatted string

Hi Clod,

The error you've got is normal.
I'm afraid your second syntax to create the array is not producing what you think. The second syntax creates an array with only one item. This item has a key equale 0, and a value equal to the value of $mString.
That's why TBS is not able to merge it with TBS fields for the first syntax.

> Btw, I have downloaded the manual and I'd like to create
> a PDF version of it using Adobe which I'd like to share.

Yes a manual in PDF is a good idea but don't do it :
it will be available soon, made by Condutiarii.
By: Clod
Date: 2004-11-17
Time: 02:06

Re: Passing an array error if using formatted string

Skrol,

Thanks, your response was very fast...

Great! hope to get the PDF version of the manual soon... ``.:clod:.``

Btw, can you shed a light on creating an array and passing on TBS using concatenated strings.
By: Skrol29
Date: 2004-11-17
Time: 02:24

Re: Passing an array error if using formatted string

> Btw, can you shed a light on creating an array and passing on TBS using concatenated strings.

What do you mean by "passing on TBS concatenated strings" ?
By: Clod
Date: 2004-11-17
Time: 02:47

Re: Passing an array error if using formatted string

Skrol,

The purpose is to make the code readable especially in VI...
e.g.

//below  concat applies to query which i'm trying to use on array if applicable
$myString = "'strVa1'=>'xxx',"
                      ."'strVal2'=>'yyy',"
                      ."'strVal3'=>'zzz'";

or

$myString = "'strVa1'=>'xxx',";
$mySting  .= "'strVal2'=>'yyy',";
$myString .= "'strVal3'=>'zzz'";

//the result string would then be passed to MergeBlock on TBS
$arrayVal[] = array ($myString);

I don't know if i'm doing it right or in a very wrong way which i'm hoping you could shed the idea...

Thanks & More Power... ;-)
``.:clod:.``
By: Skrol29
Date: 2004-11-17
Time: 03:34

Re: Passing an array error if using formatted string

But that is not the Php syntax.
Php syntax for that is:

$arrayVal[] = array();
$arrayVal['strVa1'] = 'xxx';
$arrayVal['strVa2'] = 'yyy';
$arrayVal['strVa3'] = 'zzz';
By: Skrol29
Date: 2004-11-17
Time: 03:35

Re: Passing an array error if using formatted string

Oups... it should be:

$arrayVal = array();
$arrayVal['strVa1'] = 'xxx';
$arrayVal['strVa2'] = 'yyy';
$arrayVal['strVa3'] = 'zzz';
By: Clod
Date: 2004-11-17
Time: 04:03

Re: Passing an array error if using formatted string

Skrol,

Thank you...Thank you...Thank you...

``.:clod:.``

Btw, i'm having a hard time using magnet in TBS 2.0 unlike using the old, friend=xx on TBS 1.97

based on pass array in MergeBlock, below didn't remove the
<td></td>
if empty...i'll try to figure it out first and just post again if no success.

<td>[var.myvar;block=tr;magnet=tr]</td>
By: Clod
Date: 2004-11-17
Time: 04:12

Re: Passing an array error if using formatted string

Update...
[var.myvar;block=tr;magnet=tr]
  is working.  Thanks.

``.:clod:.``