Welcome Guest, Not a member yet? Register   Sign In
Unable to load the requested file: templates/default
#1

[eluser]Unknown[/eluser]
Hello,

I'm currently trying to install my application (which works fine in local) on olympe-network but I have an issue with my views.

I followed that tutorial (http://code.tutsplus.com/tutorials/an-in...-net-25648) so I have this library :

libraries/Template.php :
Code:
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
   class Template
   {
      var $ci;
      
      function __construct()
      {
         $this->ci =& get_instance();
      }
      
      function load($tpl_view, $body_view = null, $data = null)
        {
           if ( ! is_null( $body_view ) )
           {
              if ( file_exists( APPPATH.'views/'.$tpl_view.'/'.$body_view ) )
              {
                 $body_view_path = $tpl_view.'/'.$body_view;
              }
              else if ( file_exists( APPPATH.'views/'.$tpl_view.'/'.$body_view.'.php' ) )
              {
                 $body_view_path = $tpl_view.'/'.$body_view.'.php';
              }
              else if ( file_exists( APPPATH.'views/'.$body_view ) )
              {
                 $body_view_path = $body_view;
              }
              else if ( file_exists( APPPATH.'views/'.$body_view.'.php' ) )
              {
                 $body_view_path = $body_view.'.php';
              }
              else
              {
                 show_error('Unable to load the requested file: ' . $tpl_name.'/'.$view_name.'.php');
              }

              $body = $this->ci->load->view($body_view_path, $data, TRUE);

              if ( is_null($data) )
              {
                 $data = array('body' => $body);
              }
              else if ( is_array($data) )
              {
                 $data['body'] = $body;
              }
              else if ( is_object($data) )
              {
                 $data->body = $body;
              }
           }

           $this->ci->load->view('templates/'.$tpl_view, $data);
        }
   }

And when I load my application, I get this error :
Unable to load the requested file: templates/default

Concerned file :
Controller/auth SadION auth)
Code:
function login()
{
  [...]

   $this->data['identity'] = array('name' => 'identity',
    'id' => 'identity',
    'type' => 'text',
    'value' => $this->form_validation->set_value('identity'),
   );
   $this->data['password'] = array('name' => 'password',
    'id' => 'password',
    'type' => 'password',
   );  
  $this->template->load('default', 'auth/login', $this->data); //doesn't work (using the template)
  //$this->_render_page('auth/login', $this->data); //doesn't work (comes from ION auth)
  }
}

templates/default :
Code:
<!DOCTYPE html>
&lt;html&gt;
    &lt;head&gt;
        &lt;title&gt;&lt;?php echo $title; ?&gt;&lt;/title&gt;
        &lt;meta name="viewport" c initial-scale=1.0"&gt;
        &lt;meta charset="utf-8" /&gt;
        &lt;!-- Bootstrap --&gt;
        &lt;link href="&lt;?php echo base_url('assets/css/bootstrap.min.css'); ?&gt;" rel="stylesheet"&gt;
        &lt;link href="&lt;?php echo base_url('assets/css/style.css'); ?&gt;" rel="stylesheet"&gt;
        [removed][removed]
    &lt;/head&gt;
    &lt;body&gt;
        &lt;!-- Wrap all page content here --&gt;
        <div id="wrap">
            &lt;!-- Fixed navbar --&gt;
            <div class="navbar navbar-default navbar-fixed-top" role="navigation">
                // navbar
            </div>

            <div class="container">
                <div class="row">
                    <div class="col-md-3">
                     //menu
                     </div>
                    <div class="col-md-9">
                        <div class="page-header">
                            <h1>&lt;?php echo $title; echo (isset($subtitle)? ' <small>'.$subtitle.'</small>' : ''); ?&gt;</h1>
                        </div>
                        <div class="wrapper">
                            &lt;?php echo $body; ?&gt;
                        </div>
                    </div>
                </div>
            </div>
        </div

    </div>
        <div id="footer">
            <div class="container">
            </div>
        </div>
    [removed][removed]
    [removed][removed]
&lt;/body&gt;
&lt;/html&gt;

In case it could be related to htaccess :
Code:
RewriteEngine on
RewriteBase /appliname/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|js|img|css|captcha|robots\.txt)
RewriteRule ^(.*)$ /appliname/index.php/$1 [L]

It works if I don't use the template but :
$this->load->view('coming_soon', $this->data); //really basic view

I don't understand at all why it works in local but not on olympe, any idea ?

Thanks.




Theme © iAndrew 2016 - Forum software by © MyBB