Welcome Guest, Not a member yet? Register   Sign In
log page views in database where?

I want to create a simple stats component that logs the page and subpage
of every page view along with some other stuff basically I want to run a
simple database insert of $this->uri->segment(1) etc. where is the best place
to run the code in the construct function of every controller or is this a use of a hook?

or has someone written a plugin or library for this ?

You could extend the controller

class MY_Controller extends Controller
   function MY_Controller()
       $url = $this->uri->uri_string();
       // database insert


And every controller you create should insert an url in your database.

I saw somewhere on the forum you should extend the normal controllers from the MY_Controller class but i think that is not necessary because the extended class functionality should be loaded instead of the parent class. Or am i wrong about this?

Theme © iAndrew 2016 - Forum software by © MyBB