Welcome Guest, Not a member yet? Register   Sign In
I'm probably doing something stupid but it seems to be autoloading my helper class
#1

(This post was last modified: 06-09-2015, 03:31 AM by DreamOfSleeping.)

Hi. I have a helper class called my_url_helper. This has some simple functions called css_url, js_url, and image_url to help me load them. It works great. Then I noticed I had forgot to load the helper on half my pages, but it still works and I don't know why.

Things I've tried.

I checked and double checked the autoload file to make sure I hadn't added it to it. I haven't

I commented out all the parts in my code where I load the helper in case codeigniter somehow remembered it. It still works.

I wondered if the file had just been cached or something, so I added another function to the helper class called poo_face that simple returns a string saying "pooooooo face". I added a call to the poo_face function, and it worked despite the helper not being
loaded.

I thought I would ask here in case there is something that I might have overlooked.

Here is a one of my controllers and the view that has the functions.

PHP Code:
<?php

class User extends CI_Controller {
 
   
    public 
function __construct() {
 
       parent::__construct();
 
       $this->load->helper('url');
 
       $this->load->library('session');
 
       $this->load->model('user_model');
 
   }
 
   
  
    
    public 
function home() {
 
  
        $this
->load->view('user_home_view');
 
   }
 
   
    public 
function profile() {
 
       
    
}
 
   
    public 
function add_creation() {
 
       $this->load->view('add_creation_view');
 
   }



Code:
<!DOCTYPE html>
<html>
   <head>
       <title>Add Creation</title>
       <meta charset="UTF-8">
       <?php
             // both these functions are found in my_url_helper, not to be confused with the official url helper.
             echo css_url('create-critique'); // this prints out the css url
             echo poo_face(); // this prints pooooo face
       ?>
   </head>
   
</html>
   
Reply


Messages In This Thread
I'm probably doing something stupid but it seems to be autoloading my helper class - by DreamOfSleeping - 06-09-2015, 03:30 AM



Theme © iAndrew 2016 - Forum software by © MyBB