Welcome Guest, Not a member yet? Register   Sign In
Models won't load
#15

(12-08-2014, 06:21 PM)afenker1985 Wrote: Okay, let me lay this out again. I'm developing on OpenShift by Red Hat. I've setup application just as the tutorial/walkthrough says to. I can't get models to load, and I keep getting a 500 error. I've checked the log files.

When I load the webpage I get this in the logs:

Code:
[08/Dec/2014:20:13:52 -0500] "GET / HTTP/1.1" 500 - "http://2scsb-aaronfenker.rhcloud.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/600.1.25 (KHTML, like Gecko) Version/8.0 Safari/600.1.25"

If the filename of my model includes "_model, “ the page gives the CI error message, but it still throws the 500 error. If I don't include "_model" in the filename, then the page doesn't load at all, but it still throws the 500 error.

When I do a git push I get the following errors:

Code:
[08/Dec/2014:20:11:04 -0500] "HEAD / HTTP/1.1" 500 - "-" "Ruby"
[08/Dec/2014:20:11:04 -0500] "HEAD / HTTP/1.1" 500 - "-" "Ruby"
[08/Dec/2014:20:11:04 -0500] "HEAD / HTTP/1.1" 500 - "-" "Ruby"
[08/Dec/2014:20:11:04 -0500] "HEAD / HTTP/1.1" 500 - "-" "Ruby"

I deleted my original app, and started fresh just in case I goofed on something in pushes. (Git is new to me too.)

Here's my code again.

controllers/welcome.php

PHP Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class 
Welcome extends CI_Controller {

    
/**
     * Index Page for this controller.
     *
     * Maps to the following URL
     *         http://example.com/index.php/welcome
     *    - or -  
     *         http://example.com/index.php/welcome/index
     *    - or -
     * Since this controller is set as the default controller in 
     * config/routes.php, it's displayed at http://example.com/
     *
     * So any other public methods not prefixed with an underscore will
     * map to /index.php/welcome/<method_name>
     * @see http://codeigniter.com/user_guide/general/urls.html
     */
    
public function index()
    {
        
$this->load->model('Nav_menu');
        
$this->load->view('header');
        
$this->load->view('welcome_message');
        
$this->load->view('footer');
    }
    private function 
create_menu() {
        
$data['query'] = $this->Nav_menu->get_active_albums();
     
   echo $data;
 
  }


models/nav_menu.php

PHP Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class 
Nav_menu extends CI_Model {
    function 
__construct() {
     
       parent::__construct();
    }
    
    function 
get_active_albums() {
        
$query $this->db->get_where('albums', array('is_active' 1));
        
        return 
$query->result();
    }


Is there a setting that I'm missing somewhere?

Call the method with all lower letter 
PHP Code:
$this->load->model('nav_menu'); 

...and use it with $this->nav_menu->..........
Reply


Messages In This Thread
Models won't load - by afenker1985 - 12-06-2014, 10:49 AM
RE: Models won't load - by InsiteFX - 12-06-2014, 06:26 PM
RE: Models won't load - by afenker1985 - 12-08-2014, 09:53 AM
RE: Models won't load - by skinner92 - 12-06-2014, 07:40 PM
RE: Models won't load - by bw.balazs - 12-07-2014, 04:48 AM
RE: Models won't load - by skinner92 - 12-07-2014, 04:34 PM
RE: Models won't load - by afenker1985 - 12-08-2014, 10:00 AM
RE: Models won't load - by twpmarketing - 12-08-2014, 01:09 PM
RE: Models won't load - by afenker1985 - 12-08-2014, 06:21 PM
RE: Models won't load - by Dracula - 12-09-2014, 05:39 AM
RE: Models won't load - by Dracula - 12-09-2014, 05:40 AM
RE: Models won't load - by Avenirer - 12-09-2014, 07:37 AM
RE: Models won't load - by Avenirer - 12-09-2014, 07:38 AM
RE: Models won't load - by afenker1985 - 12-09-2014, 06:57 AM
RE: Models won't load - by Dracula - 12-09-2014, 07:19 AM
RE: Models won't load - by afenker1985 - 12-09-2014, 07:34 AM
RE: Models won't load - by Dracula - 12-09-2014, 07:44 AM
RE: Models won't load - by afenker1985 - 12-09-2014, 08:02 AM
RE: Models won't load - by Dracula - 12-09-2014, 08:08 AM
RE: Models won't load - by afenker1985 - 12-09-2014, 08:12 AM
RE: Models won't load - by Dracula - 12-09-2014, 08:15 AM
RE: Models won't load - by afenker1985 - 12-09-2014, 08:17 AM
RE: Models won't load - by Dracula - 12-09-2014, 08:28 AM
RE: Models won't load - by Dracula - 12-09-2014, 10:36 AM
RE: Models won't load - by afenker1985 - 12-09-2014, 10:56 AM
RE: Models won't load - by afenker1985 - 12-09-2014, 11:25 AM
RE: Models won't load - by Dracula - 12-09-2014, 12:15 PM
RE: Models won't load - by Rufnex - 12-11-2014, 02:55 PM



Theme © iAndrew 2016 - Forum software by © MyBB