Welcome Guest, Not a member yet? Register   Sign In
Where to put certain code
#11

[eluser]invi[/eluser]
Hello everybody, I have similar problem to jaswinder_rana's. I'm using dx_auth and when I insert this kind of code in my view file:
Code:
<?
if (! $this->dx_auth->is_logged_in())
{
     $this->load->view('auth/logowanie.php');
}
else
{
     $this->load->view('auth/menu.php');
}
?>

I have an error:
A PHP Error was encountered

Severity: Notice

Message: Undefined property: CI_Loader::$dx_auth

Filename: views/index.php

Line Number: 28

Fatal error: Call to a member function is_logged_in() on a non-object in public_html/system/application/views/index.php on line 28

Could you help me with this? Sad
#12

[eluser]Mossab Alzeeny[/eluser]
[quote author="invi" date="1231295672"]Hello everybody, I have similar problem to jaswinder_rana's. I'm using dx_auth and when I insert this kind of code in my view file:
============
<?
if (! $this->dx_auth->is_logged_in())
{
$this->load->view('auth/logowanie.php');

}
else
{
$this->load->view('auth/menu.php');

}
?>
===========

I have an error:
A PHP Error was encountered

Severity: Notice

Message: Undefined property: CI_Loader::$dx_auth

Filename: views/index.php

Line Number: 28

Fatal error: Call to a member function is_logged_in() on a non-object in public_html/system/application/views/index.php on line 28

Could you help me with this? Sad

[/quote]

you dont need to put the extension in view path

and for the error, make sure you load the DX_auth library

Code:
$this->load->library('dx_auth');



Regards.
#13

[eluser]invi[/eluser]
Double Post :/
#14

[eluser]invi[/eluser]
when I put is_logged_in() instead of $this->dx_auth->is_logged_in() I have the following error:

Fatal error: Call to undefined function is_logged_in() in ..../system/application/views/index.php on line 29

Where should I put this code:

Code:
$this->load->library('dx_auth');
?

In view file? Do I have to do it every time?
#15

[eluser]Mossab Alzeeny[/eluser]
you should use $this->dx_auth->is_logged_in()

and for the load code, you should put it in the controller ,
for me, i use it in the Constructor




Theme © iAndrew 2016 - Forum software by © MyBB