[英]how to integrate SMF with CodeIgniter?
I am working on a project that will solely use the SMF member system. 我正在一个仅使用SMF成员系统的项目中。 Meaning that SMF is the only member system that I am using to have logins, not my own system along with SMF, just plain SMF.
这意味着SMF是我用来登录的唯一成员系统,而不是我自己的系统以及SMF,只是普通SMF。 However, I am running into one problem... I need to be able to get information from SMF based on a given ID_MEMBER.
但是,我遇到了一个问题...我需要能够根据给定的ID_MEMBER从SMF获取信息。 My article database uses SMF's ID_MEMBER field as the author information.
我的文章数据库使用SMF的ID_MEMBER字段作为作者信息。 Seeing that CodeIgniter is MVC and uses classes, I searched for a general SMF class all over the internet, but could not find one.
看到CodeIgniter是MVC并使用类,我在Internet上搜索了一个通用的SMF类,但找不到一个。 I decided to write my own, but cannot get it to work correctly... I don't have much experience with OOP.
我决定写自己的书,但无法使其正常工作...我对OOP没有太多的经验。
<?php class smf { var $context; var $memberContext; function __construct($who){ include('/../../forums/SSI.php'); $this->context = $context; } function user_context(){ return $this->context['user']; } function member_context($id = NULL){ loadMemberData($id); loadMemberContext($id); return $memberContext[$id]; }
}
The user_context function works fine, but not the member_context function. user_context函数可以正常工作,但member_context函数不能正常工作。 In the SSI.php file, the LoadmemberContext function compiles all of the information into an array called $memberContext[$id].
在SSI.php文件中,LoadmemberContext函数将所有信息编译到名为$ memberContext [$ id]的数组中。 When I call the method from my CodeIgniter controller, I get an error saying that the $memberContext variable is undefined.
当我从CodeIgniter控制器调用该方法时,出现一条错误消息,提示$ memberContext变量未定义。 Why is this happening?
为什么会这样呢?
I stumbled upon this question too and managed to fix it. 我也偶然发现了这个问题,并设法解决了这个问题。 Try this, it worked for me:
试试这个,对我有用:
function member_context($id = NULL) {
loadMemberData($id);
loadMemberContext($id);
global $user_profile;
return $user_profile[$id];
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.