WordPress database error: [Table './www@002ehuoyue@002eorg/huoyue_useronline' is marked as crashed and should be repaired]
DELETE FROM huoyue_useronline WHERE user_ip = '54.161.118.57' OR timestamp < DATE_SUB('2019-07-24 08:55:39', INTERVAL 300 SECOND)

WordPress database error: [Table './www@002ehuoyue@002eorg/huoyue_useronline' is marked as crashed and should be repaired]
REPLACE INTO `huoyue_useronline` (`timestamp`,`user_type`,`user_id`,`user_name`,`user_ip`,`user_agent`,`page_title`,`page_url`,`referral`) VALUES ('2019-07-24 08:55:39','guest','0','Guest','54.161.118.57','CCBot/2.0 (https://commoncrawl.org/faq/)','火跃工作室 &raquo; Archive &raquo; discuz后台导航添加非后台链接','/discuz-admin-showsubmenu-url','')

WordPress database error: [Table './www@002ehuoyue@002eorg/huoyue_useronline' is marked as crashed and should be repaired]
SELECT COUNT( * ) FROM huoyue_useronline

专注于discuz,uchome,dedecms等各类PHP程序仿站(二次开发和模板制作)。

« »

discuz后台导航添加非后台链接

在写discuz后台时,我们会在导航加一些前台的连接,但是DZ后台的菜单默认是会在网址前面加上“admin.php?action=”的。所以就看了一下函数”showsubmenu”的源代码:

function showsubmenu($title, $menus = array(), $right = ”, $replace = array()) {
if(empty($menus)) {
$s = ‘<div>’.$right.’<h3>’.cplang($title, $replace).’</h3></div>’;
} elseif(is_array($menus)) {
$s = ‘<div>’.$right.’<h3>’.cplang($title, $replace).’</h3><ul>’;
foreach($menus as $k => $menu) {
if(is_array($menu[0])) {
$s .= ‘<li id=”addjs’.$k.’” onmouseover=”dropmenu(this);”><a href=”#”><span>’.cplang($menu[0]['menu']).’<em>&nbsp;&nbsp;</em></span></a><div id=”addjs’.$k.’child” style=”display:none;”>’;
if(is_array($menu[0]['submenu'])) {
foreach($menu[0]['submenu'] as $submenu) {
$s .= $submenu[1] ? ‘<a href=”‘.ADMINSCRIPT.’?action=’.$submenu[1].’” onclick=”‘.$submenu[3].’”>’.cplang($submenu[0]).’</a>’ : ‘<a><b>’.cplang($submenu[0]).’</b></a>’;
}
}
$s .= ‘</div></li>’;
} else {
$s .= ‘<li’.($menu[2] ? ” : ”).’><a href=”‘.(!$menu[4] ? ADMINSCRIPT.’?action=’.$menu[1] : $menu[1]).’”‘.(!empty($menu[3]) ? ‘ target=”_blank”‘ : ”).’><span>’.cplang($menu[0]).’</span></a></li>’;
}
}
$s .= ‘</ul></div>’;
}
echo !empty($menus) ? ‘<div>’.$s.’</div><div></div>’ : $s;
}

从上面代码我们可以看到,$menus里面的子群组,如果想要放非后台连接时第四个参数必须为真,如果要在新窗口打开页面,则第3个参数必须为真。

 

下面我看个实例:

showsubmenu('menu_peixun_teacher',
array(
//这个连接后台显示的会是admin.php?action=http://www.cgjoy.com/train.php?mod=teacher
 array('peixun_teacher_list', 'http://www.cgjoy.com/train.php?mod=teacher', 1),
//这个才是在新窗口打开http://www.cgjoy.com/train.php?mod=teacher
array('peixun_teacher_add', 'http://www.cgjoy.com/train.php?mod=teacher', 0,1,1) 
))

原创文章如转载,请注明:转载自火跃工作室
本文网址:http://www.huoyue.org/discuz-admin-showsubmenu-url

日志信息 »

该日志于2014-07-25 23:13由 火跃 发表在discuz分类下, 评论已关闭。

相关日志 »

没有评论

抱歉,评论被关闭