Categories > TinyButStrong general >

i have a "sub-blocks" question

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: ice.web
Date: 2009-04-29
Time: 16:06

i have a "sub-blocks" question

i use
PHP code:
$TBS->MergeBlock('main',mysql,'SELECT * FROM menu where topid=0 order by `order` desc,id asc');
$TBS->MergeBlock('sub',mysql,'SELECT * FROM menu where (topid=%p1%) order by `order` desc,id asc');
$TBS->MergeBlock('subs',mysql,'SELECT * FROM menu where (topid=%p2%) order by `order` desc,id asc');
---------------------------------------------------------------------
HTML code:
<div>
[main.name;block=div;ondata=mymain]<div>
[sub.name;block=div;p1=[main.id];ondata=mymain]
<div>[subs.name;block=div;p2=[sub.id]]</div>
</div>
</div>

but program is error:
TinyButStrong Error when merging block [subs] : MySql error message when opening the query: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%p2%) order by `order` desc,id asc' at line 1

thank you^_^
By: TomH
Date: 2009-04-29
Time: 21:01

Re: i have a "sub-blocks" question

Hello ice,
I can't answer your problem - and hope I'm not hijacking your thread here... but if you're dealing with menu trees maybe I can help anyway.
I struggled with menu trees and with the help of many ideas from many others, I came up with a generic solution that can be used for a wide variety of multilevel menus. The one aspect that I wanted from the solution was to have no db subqueries to slow down the menu creation - but still have full hierarchical menu trees.
You can see the full solution includinh source code here...
http://tomhenry.us/tbs3/ it's the first mini-app on that page.

Hope that helps a little,
TomH
By: ice.web
Date: 2009-04-30
Time: 04:17

Re: i have a "sub-blocks" question

thank you,i want this.
By: Jack
Date: 2009-05-08
Time: 06:30

Re: i have a "sub-blocks" question

PHP code:
$TBS->MergeBlock('main',mysql,'SELECT * FROM menu where topid=0 order by `order` desc,id asc');
$TBS->MergeBlock('sub',mysql,'SELECT * FROM menu where (topid=%p1%) order by `order` desc,id asc');
$TBS->MergeBlock('subs',mysql,'SELECT * FROM menu where (topid=%p1%) order by `order` desc,id asc');
By: ice.web
Date: 2009-05-08
Time: 18:03

Re: i have a "sub-blocks" question

it works!! thank you very much!