• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Models won't load

#21
(12-09-2014, 08:12 AM)afenker1985 Wrote: I did what you asked, and now I just get a blank screen instead of the CI error message.

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 __construct() {
        
parent::__construct();
        
        
$this->load->model('nav_m_model');
    }
    
    public function 
index()
    {
        
$this->create_menu();
        
$this->load->view('header');
        
$this->load->view('welcome_message');
        
$this->load->view('footer');
    }
    private function 
create_menu() {
        
$data['query'] = $this->nav_m_model->get_active_albums();
     
   print_r($data);
 
  }


I edited my answer above.
Romanian CodeIgniter Team :: Translations :: Comunity :: Developers
http://www.codeigniter.com.ro
Reply

#22
I did all of that, and still blank screen.

(12-09-2014, 08:15 AM)Dracula Wrote:
(12-09-2014, 08:12 AM)afenker1985 Wrote: I did what you asked, and now I just get a blank screen instead of the CI error message.

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 __construct() {
        
parent::__construct();
        
        
$this->load->model('nav_m_model');
    }
    
    public function 
index()
    {
        
$this->create_menu();
        
$this->load->view('header');
        
$this->load->view('welcome_message');
        
$this->load->view('footer');
    }
    private function 
create_menu() {
        
$data['query'] = $this->nav_m_model->get_active_albums();
     
   print_r($data);
 
  }


I edited my answer above.
Reply

#23
(12-09-2014, 08:17 AM)afenker1985 Wrote: I did all of that, and still blank screen.


(12-09-2014, 08:15 AM)Dracula Wrote:
(12-09-2014, 08:12 AM)afenker1985 Wrote: I did what you asked, and now I just get a blank screen instead of the CI error message.

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 __construct() {
        
parent::__construct();
        
        
$this->load->model('nav_m_model');
    }
    
    public function 
index()
    {
        
$this->create_menu();
        
$this->load->view('header');
        
$this->load->view('welcome_message');
        
$this->load->view('footer');
    }
    private function 
create_menu() {
        
$data['query'] = $this->nav_m_model->get_active_albums();
     
   print_r($data);
 
  }


I edited my answer above.

Is there a way to send me your app with the database?
Romanian CodeIgniter Team :: Translations :: Comunity :: Developers
http://www.codeigniter.com.ro
Reply

#24
I received your app and...it's a mess Smile 

First of all, your app is not in the root of your directory...

Second, you have to create a .htaccess file in you php directory (where you have the index.php from codeigniter) and paste this in:

Code:
<IfModule mod_rewrite.c>

 Options +FollowSymLinks
 RewriteEngine on

 # Send request via index.php
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule ^(.*)$ index.php?/$1 [L]

</IfModule>


Second, rename the nav_m_model - it's just to long - with nav_m and be sure to replace in your controller

PHP Code:
replace this
$this
->load->model('nav_m_model');

with
$this
->load->model('nav_m');

and
$this->load->nav_m_model

with
$this
->load->nav_m 

Third, in your views, header change this:

PHP Code:
<? echo '<link rel="stylesheet" href="' base_url() . 'assets/css/base.css">' ?>
<? 
echo '<link rel="stylesheet" href="' base_url() . 'assets/css/layout.css">' ?>

to this
<?php echo '<link rel="stylesheet" href="' base_url() . 'assets/css/base.css">' ?>
<?php 
echo '<link rel="stylesheet" href="' base_url() . 'assets/css/layout.css">' ?>

or like this
<?= '<link rel="stylesheet" href="' base_url() . 'assets/css/base.css">' ?>
<?= 
'<link rel="stylesheet" href="' base_url() . 'assets/css/layout.css">' ?>

Same thing to the welcome_message.php

PHP Code:
<? echo '<img src="' base_url() . 'assets/imgs/welcome.jpg" style="width: 300px; float: left; margin: 0 1em 1em 0;" />' ?>

It's better this way...and try not to use inline style
<img src="<?php echo site_url('assets/imgs/welcome.jpg'); ?>" style="width: 300px; float: left; margin: 0 1em 1em 0;" alt=""> 

I didn't have time to test the db you send me but it should work just fine...let me know if things are not working.
Romanian CodeIgniter Team :: Translations :: Comunity :: Developers
http://www.codeigniter.com.ro
Reply

#25
I'll try all that. The problem with it not being in the root directory is that's what OpenShift does with it. Unless I did something wrong in my setup, which is completely possible. Is there a workaround in CI's settings?
Reply

#26
Things are still not working.

Quote:An Error Was Encountered

Unable to locate the model you have specified: nav_m
Reply

#27
(12-09-2014, 11:25 AM)afenker1985 Wrote: Things are still not working.


Quote:An Error Was Encountered

Unable to locate the model you have specified: nav_m


I testet with the db you provided...
I made some modifications to it:
Moved to CI 3
Conection to db using PDO driver.
Some small improvments to the views - separated the header and footer from the content
The app works perfect now, i will send you a mail with the link for download.

Here is my skype id if you need more help.
ghostway.solutions
Romanian CodeIgniter Team :: Translations :: Comunity :: Developers
http://www.codeigniter.com.ro
Reply

#28
Try to load your Model with the first letter capitalized

PHP Code:
$this->load->model('Nav_m_model'); 

Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.