DEDECMS会员信息在个人模板中的调用方法

会员信息在个人模板info和index的调用问题,好长时间没解决 论坛发帖没人回答 看了一晚上代码 自己解决了。
 
会员个人空间 index.htm 、 listarticle.htm不能像infos.htm模板一样使用
 
 
会员index.php以及变量文件index_do.php都由变量控制,首页模板在index.php中改写,其他文件则在会员文件夹下Inc/space_action.php中有说明。 
以下为例子,要让index.htm同样和infos.htm一样调用处联动数据,header.htm跟随模板文件的改动而相应,比如infos支持,这个页面的header.htm加在调用会成功,否则失败报错。 
将Inc/space_action.php文件中的 
/*--------------------------------- 
个人资料 
function infos(){ } 
-------------------------------------*/ 
else if($action=='infos') 
include_once(DEDEDATA.'/enums/nativeplace.php'); 
include_once(DEDEINC."/enums.func.php"); 
$row = $dsql->GetOne("select * from `dede_member_person` where mid='{$_vars['mid']}' "); 
$dpl = new DedeTemplate(); 
$dpl->LoadTemplate(DEDEMEMBER."/space/{$_vars['spacestyle']}/infos.htm"); 
$dpl->display(); 
 
拷贝到index.php 经过筛选后的此位置, 
/*----------------------------- 
//会员空间主页 
function space_index(){ } 
------------------------------*/ 
else 
require_once(DEDEMEMBER.'/inc/config_space.php'); 
if($action == '') 
include_once(DEDEINC."/channelunit.func.php"); 
$dpl = new DedeTemplate(); 
$tplfile = DEDEMEMBER."/space/{$_vars['spacestyle']}/index.htm"; 
 
改写方式如下 
 
/*----------------------------- 
//会员空间主页 
function space_index(){ } 
------------------------------*/ 
else 
require_once(DEDEMEMBER.'/inc/config_space.php'); 
include_once(DEDEDATA.'/enums/nativeplace.php');/*--后添加复制过来--*/ 
include_once(DEDEINC."/enums.func.php");/*--后添加复制过来--*/ 
if($action == '') 
include_once(DEDEINC."/channelunit.func.php"); 
$row = $dsql->GetOne("select * from `dede_member_person` where mid='{$_vars['mid']}' ");/*--后添加复制过来--*/ 
$dpl = new DedeTemplate(); 
$tplfile = DEDEMEMBER."/space/{$_vars['spacestyle']}/index.htm"; 
 
综上所述 只要在相应的位置添加以下三条数据即可 
include_once(DEDEDATA.'/enums/nativeplace.php');/*--后添加复制过来--*/ 
include_once(DEDEINC."/enums.func.php");/*--后添加复制过来--*/ 
$row = $dsql->GetOne("select * from `dede_member_person` where mid='{$_vars['mid']}' ");/*--后添加复制过来--*/ 
 
备注:相应的其他页面只需要在 Inc/space_action.php 统一添加三条语句即可

相关文章

文章浏览阅读483次。dedecms织梦频道模板中调用栏目分类并排...
文章浏览阅读284次。我们在用织梦建站的过程中,难免会遇到各...
文章浏览阅读152次。seo专题是seo优化必不可少的一环,对于网...
文章浏览阅读142次。在Dedecms中,在列表页调用文章摘要的方...
文章浏览阅读234次。织梦DedeCMS文章内容发布时可以选择“头...
文章浏览阅读701次。虽然织梦DedeCMS因为安全问题被人所诟病...