Welcome Guest, Not a member yet? Register   Sign In
Not Picking Up If Exist File
#1

[eluser]razerone[/eluser]
I am just trying something new Not picking up file if exist

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

Code:
class Welcome extends CI_Controller {

public function index() {

  if (file_exists(APPPATH . 'views/theme/' . $filename)) {
      $this->load->view('theme/'.$filename);
  }
  else {
      $this->load->view('default/template/common/welcome_message.php');
  }
}
}
#2

[eluser]razerone[/eluser]
I have got it working so far.

Code:
public function index() {

  if (file_exists('views/theme/')) {
      $this->load->view('theme'. $filename);
  }
  else {
      $this->load->view('/theme/default/template/common/welcome_message.php');
  }
}
#3

[eluser]Otemu[/eluser]
where is $filename defined??
most likely your using the wrong path or wrong file name
#4

[eluser]Tpojka[/eluser]
Maybe this can be solution:

Code:
public function index() {

  if (!$this->load->view('theme'. $filename)) {
      $this->load->view('/theme/default/template/common/welcome_message.php');
  }
}
#5

[eluser]razerone[/eluser]
[quote author="Tpojka" date="1382699696"]Maybe this can be solution:

Code:
public function index() {

  if (!$this->load->view('theme'. $filename)) {
      $this->load->view('/theme/default/template/common/welcome_message.php');
  }
}
[/quote]

I also need to pass an array of couple of controllers not picking up must be done for something else what is codeigniter equilvent

$this->children = array(
'common/footer',
'common/header'
);




Theme © iAndrew 2016 - Forum software by © MyBB