2.header.html代碼:javascript
[php] view plain copy php
<EMBED id=ZeroClipboardMovie_1 name=ZeroClipboardMovie_1 type=application/x-shockwave-flash align=middle pluginspage=http://www.macromedia.com/go/getflashplayer height=14 width=29 src=http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf wmode="transparent" flashvars="id=1&width=29&height=14" allowfullscreen="false" allowscriptaccess="always" bgcolor="#ffffff" quality="best" menu="false" loop="false">html
print ?5.在公共代碼放入iframe文件中後,最好在iframe外邊再加一個div來控制位置java
如: web
<div class="log"> cookie
你好 (小偉), app
<a target="_blank" href="http://zhencms1.com/index.php?m=member&siteid=1">會員中心</a> oop
<a target="_top" href="http://zhencms1.com/index.php?m=member&c=index&a=logout&forward=http%3A%2F%2Fzhencms1.com%2Findex.php%3Fm%3Dcontent%26c%3Dindex%26a%3Dshow%26catid%3D18%26id%3D1&siteid=1">退出</a> ui
</div> url
<div style="margin:0 auto;width:1000px;height:28px;">
<script type="text/javascript">document.write('<iframe src="{APP_PATH}index.php?m=member&c=index&a=mini&forward='+encodeURIComponent(location.href)+'&siteid={get_siteid()}" allowTransparency="true" width="1000" height="28" frameborder="0" scrolling="no"></iframe>')</script>
</div>
<EMBED id=ZeroClipboardMovie_5 name=ZeroClipboardMovie_5 type=application/x-shockwave-flash align=middle pluginspage=http://www.macromedia.com/go/getflashplayer height=14 width=29 src=http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf wmode="transparent" flashvars="id=5&width=29&height=14" allowfullscreen="false" allowscriptaccess="always" bgcolor="#ffffff" quality="best" menu="false" loop="false">
print ?[php] view plain copy
<div class="log">{if $_username}{L('hellow')} {get_nickname()}, <a href="{APP_PATH}index.php?m=member&siteid={$siteid}" target="_blank">{L('member_center')}</a> <a href="{APP_PATH}index.php?m=member&c=index&a=logout&forward={urlencode($_GET['forward'])}&siteid={$siteid}" target="_top">{L('logout')}</a>{else}<a href="{APP_PATH}index.php?m=member&c=index&a=register&siteid={$siteid}" target="_blank">{L('register')}</a> <span>|</span> <a href="{APP_PATH}index.php?m=member&c=index&a=login&forward={urlencode($_GET['forward'])}&siteid={$siteid}" target="_top">{L('login')}</a>
{/if}</div>
[php] view plain copy
/**
* 獲取經過 set_cookie 設置的 cookie 變量
* @param string $var 變量名
* @param string $default 默認值
* @return mixed 成功則返回cookie 值,不然返回 false
*/
public static function get_cookie($var, $default = '') {
$var = pc_base::load_config('system','cookie_pre').$var;
return isset($_COOKIE[$var]) ? sys_auth($_COOKIE[$var], 'DECODE') : $default;
}
<EMBED id=ZeroClipboardMovie_4 name=ZeroClipboardMovie_4 type=application/x-shockwave-flash align=middle pluginspage=http://www.macromedia.com/go/getflashplayer height=14 width=29 src=http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf wmode="transparent" flashvars="id=4&width=29&height=14" allowfullscreen="false" allowscriptaccess="always" bgcolor="#ffffff" quality="best" menu="false" loop="false">
print ?[php] view plain copy
4.找到phpcms/templates/member/mini.html文件:
<script type="text/javascript">
document.write('<iframe src="{APP_PATH}index.php?m=member&c=index&a=mini&forward='+encodeURIComponent(location.href)+'&siteid={get_siteid()}" allowTransparency="true" width="500" height="24" frameborder="0" scrolling="no"></iframe>')
</script>
3.找到phpcms/modules/member/index.php控制器中的mini方法
<EMBED id=ZeroClipboardMovie_3 name=ZeroClipboardMovie_3 type=application/x-shockwave-flash align=middle pluginspage=http://www.macromedia.com/go/getflashplayer height=14 width=29 src=http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf wmode="transparent" flashvars="id=3&width=29&height=14" allowfullscreen="false" allowscriptaccess="always" bgcolor="#ffffff" quality="best" menu="false" loop="false">
print ?//mini登錄條
public function mini() {
//獲取經過 set_cookie 設置的 _username 變量
$_username = param::get_cookie('_username');
//獲取經過 set_cookie 設置的 _userid 變量
$_userid = param::get_cookie('_userid');
//當前站點
$siteid = isset($_GET['siteid']) ? intval($_GET['siteid']) : '';
//定義站點id常量
if (!defined('SITEID')) {
define('SITEID', $siteid);
}
$snda_enable = pc_base::load_config('system', 'snda_enable');
//頂部登陸信息:歡迎 xxx 登陸 ,會員中心、退出
include template('member', 'mini');
}
[php] view plain copy
<EMBED id=ZeroClipboardMovie_2 name=ZeroClipboardMovie_2 type=application/x-shockwave-flash align=middle pluginspage=http://www.macromedia.com/go/getflashplayer height=14 width=29 src=http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf wmode="transparent" flashvars="id=2&width=29&height=14" allowfullscreen="false" allowscriptaccess="always" bgcolor="#ffffff" quality="best" menu="false" loop="false">
print ?
備註:param::get_cookie('_username')所在位置:phpcms/libs/classes/param.class.php類庫文件【參數處理類】