Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.

panelbutton

Will show the collapse or expand button for panels which are collapsible.

panelbutton

Quote

panelbutton ( string $state , string $bname )


Parameters
state
This is the current state of the panel which is on (expanded) or off (collapsed).

bname
The name of the panel (box name) which is used by the cookies to identify if the panel is expanded or collapsed. See example on how this is used.

Return Values
This function will return a button for expanding or collapsing a panel depending on the panel's status.

Example pf a panelbutton() from Gillette theme
Code
<?php
function openside($title, $collapse = false, $state = "on") {
 
 global $panel_collapse; $panel_collapse = $collapse;
 
 echo "<table cellpadding='0' cellspacing='0' width='100%'>n<tr>n";
 echo "<td class='scapmain-left'></td>n";
 echo "<td class='scapmain'>$title</td>n";
 if ($collapse == true) {
 $boxname = str_replace(" ", "", $title);
 echo "<td class='scapmain' align='right'>".panelbutton($state, $boxname)."</td>n";
 }
 echo "<td class='scapmain-right'></td>n";
 echo "</tr>n</table>n";
 echo "<table cellpadding='0' cellspacing='0' width='100%' class='spacer'>n<tr>n";
 echo "<td class='side-body'>n";
 if ($collapse == true) { echo panelstate($state, $boxname); }
}
?>

Here is how the panelbutton() function is used inside the Gillette theme (theme.php).

Example of a basic panelbutton()
Code
<?php
// Panel button's state is "on"
panelbutton("on", "PanelName");
 
// Panel button's state is "off"
panelbutton("off", "PanelName");
?>

Here we are just displaying what the function very basically will output.

Output from basic example

Quote

// Panel buttons state is "on"
<img src='themes/Gillette/images/panel_off.gif' id='b_PanelName' class='panelbutton' alt='' onclick="javascript:flipBox('PanelName')" />
// Panel buttons state is "off"
<img src='themes/Gillette/images/panel_on.gif' id='b_PanelName' class='panelbutton' alt='' onclick="javascript:flipBox('PanelName')" />


Changelog
7.00.00 - Added to PHPFusion´s theme engine in order to make it easier for designers.