我想在我自己的channle中显示已经登录的用户的名称
通常的解决办法:
打开ss目录下的batch.panel.php,打getcookie();改为getcookie(1);
这样你就可以模板用$_SGLOBAL['supe_username'] 调用当前登陆者的用户名。
效果是:
在我的菜单部分替换为登录的用户名!
但这不是我想要的,这种方式比较老套,而且占用很大的空间,
我的解决办法如下:
比如在:
channel_siteindex.html.php(我自己创建的一个)
<div class="search_header">
<span class="search_save"><a href="#">加入收藏</a> | <a href="#">登陆</a></span>
<span class="search_anniu">
如果使用
getcookie(1)
$_SGLOBAL[supe_username_show]
。。。。。。。。。。。。。。。。。
</div>
不行,调用不到,显示的是空
其实很简单,就是改造一下batch.panel.php
document.write(' <strong>$_SGLOBAL[supe_username_show]</strong> ');
document.write('<a href="$uid_url" target="_blank">个人空间</a> ');
document.write('<a href="$bbsurl/pm.php" target="_blank">站内短信</a> ');
document.write('<a href="$siteurl/?action-site-type-panel" target="_self">快捷面板</a> <a href="$siteurl/batch.login.php?action=logout" target="_self">退出</a> ');
效果如下:
登录前--
当然,你可以重新写一个,要不然直接修改会影响整个网站所有用到batch。Panel的地方。
剩下的就是到你自己新建的页面中把改造后的batch。Panel引入进来了~~
全部源代码,可以到这里访问获得
http://www.jxc114.com/bbs/thread-789-1-1.html
演示网页:
http://www.jxc114.com