Categories > TinyButStrong general >

Merging block problem + check mechanism

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: fatalterror
Date: 2009-10-23
Time: 08:41

Merging block problem + check mechanism

Hi,

Here’s the simple code…

PHP:
$TBS->MergeBlock('menu',$connection,'SELECT * FROM '.$menu.' WHERE child_id = 0 ORDER BY sort_id');
$TBS->MergeBlock('submenu',$connection,'SELECT * FROM '.$menu.' WHERE child_id = %p1% ORDER BY sort_id');
$TBS->MergeBlock('subsubmenu',$connection,'SELECT * FROM '.$menu.' WHERE child_id = %p1% ORDER BY sort_id');

HTML:
                <ul>
                    <li><a href="#" class="velos">[menu.title;block=li;]</a>
                        <ul>
                            <li><a href="#">[submenu.title;p1=[menu.id];bmagnet=ul;block=li;]</a>
                                <ul>
                                    <li><a href="#">[subsubmenu.title;p1=[submenu.id];bmagnet=ul;block=li;]</a></li>
                                </ul>
                            </li>
                        </ul>
                    </li>
                </ul>

I was wondering if there is any way to remove the class=”velos” when there is no submenus? And attach the class when there is a submenu under the root level?

In other words I would like to check if there is submenu  or subsubmenu and then apply the class=”velos” to the menu block...

thanks
By: Skrol29
Date: 2009-10-23
Time: 14:46

Re: Merging block problem + check mechanism

Hello,

you can try this (not tested):
    <ul>
     <li><a href="#" class="[submenu.#;if [val]=0;then '';else 'velo']">[menu.title;block=li;]</a>
      <ul>
       <li><a href="#" class="[subsubmenu.#;if [val]=0;then '';else 'velo']">[submenu.title;p1=[menu.id];bmagnet=ul;block=li;]</a>
        <ul>
         <li><a href="#">[subsubmenu.title;p1=[submenu.id];bmagnet=ul;block=li;]</a></li>
        </ul>
       </li>
      </ul>
     </li>
    </ul>