Witam. Tak sobie siedzę i kombinuję. Spodobało mi się dawne menu, które było kiedyś na Supporcie. Posklejałem to "na żywca" (jak w temacie: http://www.php-fu...rowstart=0, ale przydałoby się instalację tego uprościć. Może ktoś będzie chętny przerobić to tak, aby było mniej modyfikacji w plikach.
1. Wkleić w theme.php przed function render_page:
function render_tiny_menu() {
global $theme_width, $locale;
$result = dbquery("SELECT * FROM ".DB_PREFIX."site_links WHERE link_url='---' AND link_name!='---' ORDER BY link_order");
$tabsrows = dbrows($result);
$i=0;
if ($tabsrows>0) echo "<div class='tabs'>\n<ul>\n";
while ($data = dbarray($result)) {
if (checkgroup($data['link_visibility'])) {
echo "<li id='menutab_".$data['link_id']."'".($i==0?" class='current'":"")."><span><a href=\"javascript:wooyaTabs.displayTab('menutab_".$data['link_id']."','menupanel_".$data['link_id']."');\" onmousedown=\"return false;\">".$data['link_name']."</a></span></li>\n";
}
$i++;
}
if ($tabsrows>0) echo "</ul>\n</div>\n";
if ($tabsrows>0) {
$result = dbquery("SELECT * FROM ".DB_PREFIX."site_links WHERE link_name!='---' ORDER BY link_order");
} else {
$result = dbquery("SELECT * FROM ".DB_PREFIX."site_links WHERE link_position>='2' ORDER BY link_order");
}
$rows = dbrows($result);
$i=0; $j=0; $sep = "<img src='".THEME."images/bullet.gif' alt='0' border='0'>";
echo "<div class='panel_wrapper'>\n";
while ($data = dbarray($result)) {
if (checkgroup($data['link_visibility'])) {
if ($data['link_url']=='---' && $i!=0) { echo "</div>\n"; $j=0; }
if ($data['link_url']=='---') echo "<div id='menupanel_".$data['link_id']."' class='".($i==0?"panel current":"panel")."'>";
if ($data['link_url']!="---") {
if ($i != 0 && $j!=0) { echo " ".$sep."\n"; } else { echo "\n"; }
$link_target = $data['link_window'] == "1" ? " target='_blank'" : "";
if (strstr($data['link_url'], "http://") || strstr($data['link_url'], "https://")) {
echo "<a href='".$data['link_url']."'".$link_target.">".$data['link_name']."</a>\n";
} else {
echo "<a href='".BASEDIR.$data['link_url']."'".$link_target.">".$data['link_name']."</a>\n";
}
$i++; $j++;
}
}
}
if ($tabsrows>0) echo "</div>";
echo "</div>";
}
Kliknij i zaczekaj na załadowanie kodu ...
2. Wkleić po:
function render_page($license=false) {
global $settings, $main_style;
to:
?>
<script type="text/javascript">
/**
* $RCSfile: mctabs.js,v $
* $Revision: 1.2 $
* $Date: 2006/02/06 20:11:09 $
*
* Moxiecode DHTML Tabs script.
*
* @author Moxiecode
* @copyright Copyright Š 2004-2006, Moxiecode Systems AB, All rights reserved.
* @modified by Wooya
*/
function WooyaTabs() {
this.settings = new Array();
};
WooyaTabs.prototype.init = function(settings) {
this.settings = settings;
};
WooyaTabs.prototype.getParam = function(name, default_value) {
var value = null;
value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name];
// Fix bool values
if (value == "true" || value == "false")
return (value == "true");
return value;
};
WooyaTabs.prototype.displayTab = function(tab_id, panel_id) {
var panelElm = document.getElementById(panel_id);
var panelContainerElm = panelElm ? panelElm.parentNode : null;
var tabElm = document.getElementById(tab_id);
var tabContainerElm = tabElm ? tabElm.parentNode : null;
var selectionClass = this.getParam('selection_class', 'current');
if (tabElm && tabContainerElm) {
var nodes = tabContainerElm.childNodes;
// Hide all other tabs
for (var i=0; i<nodes.length; i++) {
if (nodes[i].nodeName == "LI")
nodes[i].className = '';
}
// Show selected tab
tabElm.className = 'current';
}
if (panelElm && panelContainerElm) {
var nodes = panelContainerElm.childNodes;
// Hide all other panels
for (var i=0; i<nodes.length; i++) {
if (nodes[i].nodeName == "DIV")
nodes[i].className = 'panel';
}
// Show selected panel
panelElm.className = 'current';
}
};
WooyaTabs.prototype.getAnchor = function() {
var pos, url = document.location.href;
if ((pos = url.lastIndexOf('#')) != -1)
return url.substring(pos + 1);
return "";
};
// Global instance
var wooyaTabs = new WooyaTabs();
</script>
<?
Kliknij i zaczekaj na załadowanie kodu ...
3. Do styles.css Waszego theme dodać:
/* This file contains the CSS data for all popups in TinyMCE */
/* Tabs classes */
.tabs {
float: left;
width: 100%;
line-height: normal;
background-image: url("images/tabs/tabs_bg.gif");
}
.tabs ul {
margin: 0;
padding: 0 0 0;
list-style: none;
}
.tabs li {
float: left;
background: url("images/tabs/tab_bg.gif") no-repeat left top;
margin: 0;
margin-left: 0;
margin-right: 2px;
padding: 0 0 0 10px;
line-height: 18px;
}
.tabs li.current {
background: url("images/tabs/tab_sel_bg.gif") no-repeat left top;
margin-right: 2px;
}
.tabs span {
float: left;
display: block;
background: url("images/tabs/tab_end.gif") no-repeat right top;
padding: 0px 10px 0 0;
}
.tabs .current span {
background: url("images/tabs/tab_sel_end.gif") no-repeat right top;
}
.tabs a {
text-decoration: none;
font-family: Verdana, Arial;
font-size: 11px;
}
.tabs a:link, .tabs a:visited, .tabs a:hover {
color: black;
}
.tabs a:hover {
}
.tabs .current {
}
.tabs .current a, .tabs .current a:link, .tabs .current a:visited {
}
.panel_wrapper div.panel {
display: none;
}
.panel_wrapper div.current {
display: block;
width: 100%;
overflow: visible; /* Should be auto but that breaks Safari */
}
.panel_wrapper {
border: 1px solid #919B9C;
border-top: 0px;
padding: 10px;
padding-top: 5px;
clear: both;
background-color: white;
}
fieldset {
border: 1px solid #919B9C;
font-family: Verdana, Arial;
font-size: 11px;
padding: 0;
margin: 0;
padding: 4px;
}
legend {
color: #2B6FB6;
font-weight: bold;
}
.properties {
width: 100%;
}
.properties .column1 {
}
.properties .column2 {
text-align: left;
}
#plugintable thead {
font-weight: bold;
background-color: #DDDDDD;
}
#plugintable, #about #plugintable td {
border: 1px solid #919B9C;
}
#plugintable {
width: 99%;
margin-top: 10px;
}
#pluginscontainer {
height: 290px;
overflow: auto;
}
/* MSIE Specific styles */
* html .panel_wrapper {
width: 100%;
}
.column {
float: left;
}
h1, h2, h3, h4 {
color: #2B6FB6;
margin: 0;
padding: 0;
padding-top: 5px;
}
h3 {
font-size: 12px;
}
#link .panel_wrapper, #link div.current {
height: 125px;
}
#image .panel_wrapper, #image div.current {
}
/* Disables the advanced tab in the table plugin. */
/*
#table #advanced_tab {
display: none;
}
*/
/* Disables the border input field and label in the table plugin. */
/*
#table #border, #table #borderlabel {
display: none;
}
*/
4. Jeśli chcecie mieć nową belkę, wklejacie takie coś:
echo "<table cellpadding='0' cellspacing='0' width='100%'>\n<tr>\n";
echo "<td class='sub-header'>";
render_tiny_menu();
echo "</td>\n";
echo "</tr>\n</table>\n";
A jeśli w zamian za standardową belkę:
echo "<table cellpadding='0' cellspacing='0' width='100%'>\n<tr>\n";
echo "<td class='sub-header'>".render_tiny_menu()."<td>\n";
echo "<td align='right' class='sub-header'>".showsubdate()."</td>\n";
echo "</tr>\n</table>\n";
5. Zamieścić folder tabs w folderze images Waszego theme:
http://www.php-fu...file=68302 |