بسم الله الرحمن الرحيم
طلب منى واحد معرفة اني ابرمج ليه سكربت خاص فا وافقة فاقلت ابرمج ببرنامج codeigniter
وانا عاوذ اعملها كويس فا قلت استخد codeigniter
فا او مشكلة اني لو جربة استخدم السيشن في مكتبة واستدعية عشان تعدد الاستايلات يطلع مشكلة
يطلع الخطاء ده
وده المكتبةكود PHP:
A PHP Error was encountered
Severity: Notice
Message: Undefined property: MhClass::$session
Filename: libraries/MhClass.php
Line Number: 18
Fatal error: Call to a member function userdata() on a non-object in C:\AppServ\www\code\system\application\libraries\MhClass.php on line 18
ولو استدعية المكتية في الهوم كدهكود PHP:<?php
/**
* ##############################################
* ##برمجة محمدهلال ##
* ##جميع الحقوق محفوظة لي محمدهلال ##
* ## mohamedhelal ##
* ##all rights to mohamedhelal ##
* ##email:mohamed_helal123456@hotmail.com ##
* ##############################################
*/
class MhClass extends Controller
{
protected $data=array();
function __construct()
{
parent::Controller();
$this->data['MH_Style']=$this->Style();
$this->session->userdata("M");
}
function Style()
{
return "templtes/main/";
}
function Lang_dir()
{
return "site_lang/arabic";
}
function Data()
{
return $this->data;
}
}
?>
يطلع المشكلة ديةكود PHP:$this->load->library("MhClass");
لازم استخدمة كدهكود PHP:
A PHP Error was encountered
Severity: Notice
Message: Undefined property: home::$MhClass
Filename: controllers/Home.php
Line Number: 22
Fatal error: Call to a member function Style() on a non-object in C:\AppServ\www\code\system\application\controllers\Home.php on line 22
والموديل نفس الشئ فما هو الخطاءكود PHP:$this->load->library("MhClass",null,'MhClass');
ودول الثلاثة الملفات الي انا عملهم
home.php
المكتبة MhClassكود PHP:<?php
/**
* ##############################################
* ##برمجة محمدهلال ##
* ##جميع الحقوق محفوظة لي محمدهلال ##
* ## mohamedhelal ##
* ##all rights to mohamedhelal ##
* ##email:mohamed_helal123456@hotmail.com ##
* ##############################################
*/
class home extends Controller
{
protected $style =false;
protected $data =array();
protected $lang_dir =false;
function __construct()
{
parent::Controller();
$this->load->library("MhClass",null,'MhClass');
$this->load->model("MHModel");
$this->style =$this->MhClass->Style();
$this->lang_dir =$this->MhClass->Lang_dir();
$this->data =$this->MhClass->Data();
$this->data['SETTING'] =$this->MHModel->Get_St();
$this->lang->load("index",$this->lang_dir);
}
function index()
{
$this->data['pege_title']="MO ";
$this->data['pege_keys']="F ";
$this->data['pege_desc']=" d";
$this->load->view($this->style."homepage.htm",$this->data);
}
}
?>
MhClass.php
كود PHP:<?php
/**
* ##############################################
* ##برمجة محمدهلال ##
* ##جميع الحقوق محفوظة لي محمدهلال ##
* ## mohamedhelal ##
* ##all rights to mohamedhelal ##
* ##email:mohamed_helal123456@hotmail.com ##
* ##############################################
*/
class MhClass extends Controller
{
protected $data=array();
function __construct()
{
parent::Controller();
$this->data['MH_Style']=$this->Style();
//$this->session->userdata("M");
}
function Style()
{
return "templtes/main/";
}
function Lang_dir()
{
return "site_lang/arabic";
}
function Data()
{
return $this->data;
}
}
?>
الموديل MHModel
MHModel.php
جزاكم الله خيراكود PHP:<?php
/**
* ##############################################
* ##برمجة محمدهلال ##
* ##جميع الحقوق محفوظة لي محمدهلال ##
* ## mohamedhelal ##
* ##all rights to mohamedhelal ##
* ##email:mohamed_helal123456@hotmail.com ##
* ##############################################
*/
class MHModel extends Model
{
function __construct()
{
parent::Model();
}
function Get_St()
{
//return $this->db->get("settings");
}
}
?>
ملاحظة انا محمل اخر نسخة من codeigniter


رد مع اقتباس

