Categories > TinyButStrong general >

Arrays

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Rich
Date: 2005-05-20
Time: 23:17

Arrays

Newbee to TBS, having a real problem with simple arrays.

Say I have in PHP an array

$results = array (
   "fruits",
   "numbers",
   "holes",
   "first",
   "second",
    "third");   

And I want to display that using TBS,

I have    in the php
    $TBS = new clsTinyButStrong ;
    $TBS->LoadTemplate('tpl/template.html') ;
    $TBS->MergeBlock('blk.results',$results);
    $TBS->Show() ;

And in HTML
            <table>
            <tr>[blk.results;block=tr]</tr>
            </table>
And I get
            <table>
            <tr>array</tr>
            </table>

Thanks in advance for any help
By: Pirjo Posio
Date: 2005-05-21
Time: 01:28

Re: Arrays

Hi Rich,

How about reading the manual (a few times, because it's long but good) and looking into the excellent examples on this site?
The answer to your question is on the first page of the manual, after the table of contents. It's Example2 under Mini Examples.
Example 2:
Html Template
<table>
<tr><td>[blk.val;block=tr]</td></tr>
</table>

PHP:
<?
include_once('tbs_class.php');
$TBS = new clsTinyButStrong ;
$TBS->LoadTemplate('template.htm') ;

$list = array('X','Y','Z') ;
$TBS->MergeBlock('blk',$list) ;
$TBS->Show() ;
?>

Results:
<table>
<tr><td>X</td></tr>
<tr><td>Y</td></tr>
<tr><td>Z</td></tr>
</table>
By: Rich
Date: 2005-05-21
Time: 12:02

Re: Arrays

Thanks you for the help, got it sorted. Although I would say that I did spend a considerable amount of time looking at the manual and examples and its to be honest they're not very clear. TBS is great, but could be better explained. That’s just one humble view which I'm sure will generate lots of criticism. All I'll say is that if is it's so good, why are there so many forum postings in this section?
By: Pirjo Posio
Date: 2005-05-21
Time: 16:53

Re: Arrays

Hi Rich,
I'm glad you got it sorted out! I didn't mean to offend you, just tried to make all people reading these pages and writing here to first try to solve their problem by themselves. Not to ask very basic things, which reveal people have not studied TBS much before asking.

Skrol29 has done very good work for all of us during all these years. How many? I have been following his work from April 2003, TBS 1.64. He has developed numerous new features along time. Plus very good documentation and real-life examples - not to mention this incredible forum, where you can get professional help quickly.
Don't forget forum search in trying to find answers to your problems among the solutions given to other people.

Many questions in forum arise from the numerous features in TBS, the possibility to make complex things with TBS. But also from people being lazy. And, of course, there are always people, who have language problems, who don't understand the manual text, and have to ask therefore.

As an outsider I think that all who have benefited from TBS should consider making a donation, to help Skrol29 continue his great work on this free tool. There is a link in the end of the Support page.
Hope Skrol29 is not angry on me saying so and will continue helping also me, when I need it :)
By: RwD
Date: 2005-05-27
Time: 09:45

Re: Arrays

Donationg for this tool would not really be something I don't want to do. I just don't want to do it using paypal, so no-go there... (Sorry Skrol29)

I consider the documentation as a not very clear way of understanding how tbs works for me, and some of my friends to whom I recommended tbs stopped using it because they couldn't figure out how tbs works even though they had the documentation. Even though tbs is really easy. I myself do use it as a reference, but it is sometimes hard to understand what the effect of actions will be. Perhaps a different approach would be good. I would like a help in the form of a windows help file in which you can look for keywords and get an overview of the topics. Also with a topic about general programming schemes (personal preference).

Luckily the support in this forum is really good, and skrol29 amazes me about how fast he understands some of the badly explained problems.

Perhaps in the future when I have a bit more time I could donate time and write a windows help documentation then surrender the source to skrol29 so he can maintain it, but don't expect this to happen soon...

Untill then if I cannot donate using anything other then paypall I won't donate at all, sorry...

(paypall is not my pall)
By: RwD
Date: 2005-05-30
Time: 09:58

Re: Arrays

Ok, been re-reading the manual, and it did become better then I remember it. I had to re-read it to find out because normally I only read what I need looking up the section I want to read looking for keywords. Perhaps looking for the wrong keywords is what I don't like about the manual but that is more or less my own problem :P Though it would be nice to have the manual I was suggesting as well.

btw, I think I found a little mistake:
$TBS->CacheAction(string CacheId {, int Action/MaxAge}{, string Dir})
should have been:
$TBS->CacheAction(string CacheId {, int Action/MaxAge{, string Dir}})

Right? I mean without Action/MaxAge the Dir cannot be set. Later on you use right brackets to indicate the same thing btw!
$TBS->MergeNavigationBar(string NavName, mix Options, int PageNum [, int RecCount, int PageSize])