Categories > TinyButStrong general >

Hi Mr Scroll29 help me Tranfer tree html to TBS template

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: thuc
Date: 2005-11-21
Time: 05:01

Hi Mr Scroll29 help me Tranfer tree html to TBS template

Hello Mr Scroll29
I have a html file, which demontrate a tree, when I lick the sub/plus imag, it will expand/not
Could you help me tranfer it into TBS template?
- what php?
- what template?
--------------------------
like this.
- Database Services
      Backup
      Restore
      Database Report
- Database Services
      Backup
      Restore
      Database Report
-------------------------
Anh file html

<HTML>
<HEAD>
<SCRIPT language=javascript>
function explorer(iself,name1,name2,divID) {
    if (iself.src.lastIndexOf(name1)==iself.src.length-name1.length) {   
        iself.src = name2;
        document.all[divID].style.display='';
       
    }
    else {
        iself.src = name1;
        document.all[divID].style.display='none';
    }
}
</SCRIPT>
</HEAD>
<BODY
text=#ffffff vLink=#ffffff aLink=#ffff00 link=#ffffff bgColor=#4895B6
leftMargin=4 topMargin=8  marginheight="0" marginwidth="0">
<TABLE width="192" >
  <TBODY>
  <TR>
    <TD valign="top" width="186"> <font face="Arial, Helvetica, sans-serif" size="2">
     <IMG name=a onclick="explorer(this,'images/plus.gif','images/sub.gif','DIV01');" src="images/sub.gif" width="9" height="9">Database
      Services<br>
      <SPAN id="DIV01"><img src=../images/space.gif height=1 width=29><A href="#">Backup</A><br>
      <img src=../images/space.gif height=1 width=29><A href="#">Restore</A><br>
      <img src=../images/space.gif height=1 width=29><a href="#">Database Report</a><br>
      </SPAN>
      <IMG name=b onclick="explorer(this,'images/plus.gif','images/sub.gif','DIV02');"
      src="images/sub.gif" width="9" height="9">Web Folder<BR>
      <SPAN id="DIV02"><img src=../images/space.gif height=1 width=29><A href="#">Backup</A><br>
      <img src=../images/space.gif height=1 width=29><A href="#">Restore</A><br>
      <img src=../images/space.gif height=1 width=29><A href="#">Database Report</A><br>
      </SPAN> </font></TD>
  </TR>
  </TBODY>
</TABLE>
</BODY>
</HTML>
-----------------------------
thank a lot.
By: Skrol29
Date: 2005-11-21
Time: 10:16

Re: Hi Mr Scroll29 help me Tranfer tree html to TBS template

Hello Thuc,

Your Tree Menu works well, but I don't see yet where you need merged data in it?

By the way, your Javascript is not Firefox compatible.
By: thuc
Date: 2005-11-21
Time: 11:15

Re: Hi Mr Scroll29 help me Tranfer tree html to TBS template

Hi Mr Scroll29
I like divice it into 2 part:
Php
-----
$menu[0]=array('main'=>'menu1','sub'=>'menu11');
$menu[1]=array('main'=>'menu1','sub'=>'menu12');
$menu[2]=array('main'=>'menu1','sub'=>'menu13');
$menu[3]=array('main'=>'menu2','sub'=>'menu21');
$menu[4]=array('main'=>'menu2','sub'=>'menu22');
-----------
how my template
------------
I like result
+ menu1
      menu11
      menu12
      menu13
+ menu2
      menu21
      menu22
but I do know How the template is. understand me?

Help me, my teacher!!!
thank you.
By: Skrol29
Date: 2005-11-21
Time: 13:38

Re: Hi Mr Scroll29 help me Tranfer tree html to TBS template

> Help me, my teacher!!!
!

You can use parameter "parentgrp" in order to make your menu simply.

Here is the HTML:
<table width="192">
  <tbody>
    <tr><td valign="top" width="186">
            <font face="Arial, Helvetica, sans-serif" size="2">
              [menu;block=begin;parentgrp=main]
              <img name="a" onClick="explorer(this,'images/plus.gif','images/sub.gif','div-[menu.#]');" src="images/sub.gif" width="9" height="9">[menu.main]<br>
        <span id="div-[menu.#]">
                  <span [menu;block=span]><img src="../images/space.gif" height="1" width="29"><a href="#">[menu.sub]</a><br></span>
        </span>
              [menu;block=end]
            </font></td>
    </tr>
  </tbody>
</table>

Note that I've added a <span> tag before <img>. This is because TBS has trouble to found the second section embedded into the "headergrp" section when both of them are defined with explicit syntax. I will fix this problem in the future.

And the PHP part:
include_once('tbs_class.php');

$menu[0]=array('main'=>'menu1','sub'=>'menu11');
$menu[1]=array('main'=>'menu1','sub'=>'menu12');
$menu[2]=array('main'=>'menu1','sub'=>'menu13');
$menu[3]=array('main'=>'menu2','sub'=>'menu21');
$menu[4]=array('main'=>'menu2','sub'=>'menu22');

$TBS = new clsTinyButStrong;
$TBS->LoadTemplate('test.htm');
$TBS->MergeBlock('menu',$menu);
$TBS->Show();
By: thuc
Date: 2005-11-22
Time: 05:08

Re: Hi Mr Scroll29 help me Tranfer tree html to TBS template

thank you Mr Scroll29, I will try.
By: thuc
Date: 2005-11-22
Time: 11:13

Re: Hi Mr Scroll29 help me Tranfer tree html to TBS template

Thank you Mr Scroll29
Your code is out of my imaging, you know. It is ferfectlly.I just copy and run...
Thank you very much...
I do not know How you can find it.!!!