Loading...
 
Skip to main content

HowToImplementFlipMenu

Introduction
Those Sidebars are nice, but sometimes you just don't wan't to see them all, so we would like to make them small. This is no problem with JavaScript.

/tiki/modules/mod-xyz.php

<a class='flip' href="javascript:toggle('bsagBoxCook');">

does this.
The Problem
The problem arises when you open a new Page. The Box doesn't remember it's state, because the javascript doesn't get called. which may be really nasty with big boxes like my Bsag Module. So we need to inform the HTML Code wether it shall be opend or closed when we load the page.
Solution
We include into the Module that the Cookie (which is brought in some magical way into php 😊 Data is assigned to a smarty Variabel.

/tiki/modules/mod-xyz.php

$smarty->assign_by_ref('bsag_boxstate',$bsagBoxCook);


Inside our .tpl we can now reference this Value.

/tiki/templates/modules/mod-xyz.tpl
Copy to clipboard
<div class="box"> <div class="box-title"><a class='flip' href="javascript:toggle('bsagBoxCook');">{tr}BSAG{/tr}</a></div> {if $bsag_boxstate eq 'o'} <div class="box-data" id='bsagBoxCook' style="display:block;"> {else} <div class="box-data" id='bsagBoxCook' style="display:none;"> {/if} {$data} <div class="copyright" align="center">copyright by BSAG :)</div> </div> </div>

( I was informed that the usage of center / font isn't xhtml compliant, but I'm not an XHTML Guru, so perhaps someone could fix the above lines if he strays around here. )

(Why isn't it possible to do linebreaks in Boxes. grr, so easy 😊
I fixed it in plugin code. nice contribution, I'll have to try that 😊 — mose

So this way, the Box always remembers its state. Nice isn't it ? 😊

I hope you like this, let me know.


Maddi, 23. Aug, 2003
Bremen, Germany

peace 😉

Page last modified on Thursday 28 August 2003 13:52:58 GMT-0000