Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>1) to autoload a library, just add it to the array in the file application/config/autoload.php, look for the 'library' section and paste the name of the library(without extension) there, as an element of the array.</p> <pre><code>$autoload['libraries'] = array ('auth'); </code></pre> <p>2) I suggest you use the native session handler (session library), which works pretty well and avoids you to use php $_SESSION. You set a width <code>$this-&gt;session-&gt;set_userdata(array('username' =&gt; 'User1', 'logged' =&gt; 'true')</code>, and then you retrieve the values with <code>$this-&gt;session-&gt;userdata['logged']</code>, for ex. </p> <p>Works like a charm and don't have to call session_start() and so on. Go check the help because it's really really clear on that.</p> <p>3) As for your problem, I'll go, instead, for 'hooks'. There are different hooks, depending on their 'position', i.e. the moment in which you're calling them. </p> <p>You can use, for ex.. the 'post_controller_constructor', which is called after controller initialization but BEFORE the methods, so it's in a midway between the constructor and the actual method. I usually insert this controls here. </p> <p>You define hooks in application/config/hooks.php, and give them an array: </p> <pre><code> $hook['post_controller_constructor'] = array( 'class' =&gt; 'Auth', 'function' =&gt; 'check', 'filename' =&gt; 'auth.php', filepath' =&gt; 'hooks', 'params' =&gt; array() ); </code></pre> <p>Anyway, for all these needs, the docs are pretty clear and straightforward, I suggest you read about hooks and session and you'll see everything gets much clearer!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload