By: mgb
Date: 2007-10-31
Time: 13:14
|
Conditional subblocks
Hi again,
I am in a learning process so please bare with me:)
My template:
<tr>
<td onmouseover="menuhover([rollmenu.#;block=td;when [rollmenu.url]=#]);" onmouseout="menuout([rollmenu.#]);"><a href="[rollmenu.url]"> [rollmenu.title] » </a>
<div id="rolldownmenu[rollmenu.#]" class="rolldownmenu">
[rollsubmenu;block=begin]
<a href="[rollsubmenu.url]">[rollsubmenu.title]</a>
[rollsubmenu;block=end]
<!--[if lte IE 6.5]><iframe></iframe><![endif]-->
</div>
</td>
<td><a href="[rollmenu.url;block=td;when [rollmenu.url]!=#]"> [rollmenu.title] </a></td>
<td>[rollmenu;block=td]<img src="./images/sub[var.__section]/submenu_separate.jpg"></td>
</tr>
|
My php:
$__rollmenu[1] = array('title' => 'Frontpage','url' => '/');
$__rollmenu[1]['sub'][] = array();
$__rollmenu[2] = array('title' => 'Humour','url' => '#');
$__rollmenu[2]['sub'][] = array('title' => 'Funny Cartoons','url' => '/humor/funnycartoons/');
$__rollmenu[2]['sub'][] = array('title' => 'Funny Animals','url' => '/humor/animals/');
$__rollmenu[3] = array('title' => 'Contact','url' => '#');
$__rollmenu[3]['sub'][] = array('title' => 'By Email','url' => '/contact/email/');
$__rollmenu[3]['sub'][] = array('title' => 'By phone','url' => '/contact/phone/');
$res = $__tbs->MergeBlock('rollmenu','array',$__rollmenu);
$__tbs->MergeBlock('rollsubmenu','array','__rollmenu[%p1%][sub]');
|
what I get:
<tr>
<td><a href="/"> Frontpage </a></td>
<td><img src="/images/sub1/submenu_separate.jpg"></td>
<td onmouseover="menuhover(2);" onmouseout="menuout(2);"><a href="#"> Humour » </a>
<div id="rolldownmenu2" class="rolldownmenu">
<!--[if lte IE 6.5]><iframe></iframe><![endif]-->
</div>
</td><td><img src="/images/sub1/submenu_separate.jpg"></td>
</tr>
|
What I would like to get:
<tr>
<td><a href="./"> Frontpage </a></td>
<td><img src="/images/sub1/submenu_separate.jpg"></td>
<td onmouseover="menuhover(2);" onmouseout="menuout(2);"><a href="#"> Humour » </a>
<div id="rolldownmenu2" class="rolldownmenu">
<a href="/humor/funnycartoons/">Funny Cartoons</a>
<a href="/humor/animals/">Funny Animals</a>
<!--[if lte IE 6.5]><iframe></iframe><![endif]-->
</div>
</td><td><img src="/images/sub1/submenu_separate.jpg"></td>
<td onmouseover="menuhover(3);" onmouseout="menuout(3);"><a href="#"> Contact » </a>
<div id="rolldownmenu3" class="rolldownmenu">
<a href="/contact/email/">By Email</a>
<a href="/contact/phone/">By phone</a>
<!--[if lte IE 6.5]><iframe></iframe><![endif]-->
</div>
</td><td><img src="/images/sub1/submenu_separate.jpg"></td>
</tr>
|
Notice how the sub block is never filled and the 3 menu item never inserted?
I hope someone can come to my rescue.
Thanks in advance.
|