Categories > TinyButStrong general >

Help, How to Merge in Javascript variables

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: thuc101
Date: 2006-08-13
Time: 06:50

Help, How to Merge in Javascript variables

This is my file test.php
--------------------------------------------------------
<?
$news[]=array('content'=>'content 1');
$news[]=array('content'=>'content 2');
$news[]=array('content'=>'content 3');
?>
<html>
<body>
<script type="text/javascript">
....
....
<? $j=0;?>
for(i=0;i<<? count($news);?>;i++){
fcontent[i]='<? echo $news[$j]['content'];$j++;?>'+i;
<? $j++ ?>
}
</body>
<html>
--------------------------------
This about code not working??why??
???tbs can merge like this????
By: NeverPanic
Date: 2006-08-13
Time: 22:41

Re: Help, How to Merge in Javascript variables

You completely missed the point of TBS, if not even PHP.
First, learn PHP.
Second, check out the TBS examples to see what it does.
By: Eliseu Kuiava
Date: 2006-08-18
Time: 19:39

Re: Help, How to Merge in Javascript variables

Hey, Thuc..

the main goal of the TBS is to avoid mixing the PHP and HTML codes. So if wanna Merge a Block, you should create a "model"(template) of the site in HTML and another file with the PHP code.

So if you wanna merge this block

$news[]=array('content'=>'content 1');
$news[]=array('content'=>'content 2');
$news[]=array('content'=>'content 3');

PHP: you should do the first steps, that are to link the php TBS class in your PHP file, load the template ( $TBS->LoadTemplate("model_index.htm"); ) and then put your block($news) there. Then merge the block (  $TBS->MergeBlock("blk_example",$news); ).

HTML: In your HTML file. Use the construction [blk_example.content; block=table] .

And it´s done.. simple, huh?
If have additional doubts check the example link.

See ya
By: bunak
Date: 2006-08-30
Time: 15:26

Re: Help, How to Merge in Javascript variables

Simply put js code to the external file which will be included to the template.
This file will not be merged by TBS :o)