今天,我爱模板网在用PHPCMS套网站后台时,需要在单页面的侧边栏调用登陆框(首页、栏目页、列表页调用方法都一样),做出如下的效果图:

登录前

登陆后
百度了下方法,可行:
1、首先找到\phpcms\templates\default\member\mini.html这个文件
2、将其内容修改为
01 | {php if(!HTTP_REFERER || strpos(HTTP_REFERER,'&a=login')) @header("Location: ".$_GET['forward']); } |
03 | body,html{background:none; padding:0; margin:0} |
04 | .log{line-height:25px; height:139px; width:178px; float:left; font-size:12px; padding-top:10px; padding-left:5px;} |
05 | .list { float:left; width:168px; height:30px; line-height:30px; } |
07 | < body style = "background-color:transparent" > |
08 | < div class = "log" >{if $_username}{L('hellow')} {get_nickname()}< br > < 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} |
09 | < form method = "post" action = "{APP_PATH}index.php?m=member&c=index&a=login" id = "myform" name = "myform" target = "_top" > |
10 | < input type = "hidden" name = "forward" id = "forward" value = "{if $_GET['forward']}{$_GET['forward']}{else}{HTTP_REFERER}{/if}" > |
11 | < div class = "list" >账 号:< input type = "text" id = "username" name = "username" size = "15" class = "input-text" ></ div > |
12 | < div class = "list" >密 码:< input type = "password" id = "password" name = "password" size = "16" class = "input-text" ></ div > |
13 | < div class = "list" >验 证:< input type = "text" id = "code" name = "code" size = "4" class = "input-text" >{form::checkcode('code_img', '4', '14', 75, 24)}</ div > |
14 | < div class = "list" >< input type = "submit" name = "dosubmit" id = "dosubmit" value = "{L('login')}" > | < a href = "{APP_PATH}index.php?m=member&c=index&a=register&siteid={$siteid}" target = "_blank" >{L('register')}</ a ></ div > |
3、在需要调用登陆框的位置引入下面的js:
1 | <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="178" height="139" frameborder="0" scrolling="no"></iframe>' )</script> |
你也可以对上面的 mini.html 文件进行修改。当然,如果你修改了模板的名称,就要到对应的模板文件夹里面找这个文件了。