File not found in PHP

Asked

Viewed 210 times

0

I installed a script and is working properly, but on the site there is a restricted area and when logging in, the site drops and gives the following error:

An Error Was Encountered Unable to load the requested file: .. /.. /public_html/themes/private/template.php

Follows the code of the page in question:

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

/**
 * Base Private Class - used for all private pages
 */
class Private_Controller extends MY_Controller {

    /**
     * Constructor
     */
    function __construct()
    {
        parent::__construct();

        $this->load->library('currencys');

        // must be logged in
        if ( ! $this->user)
        {
            if (current_url() != base_url())
            {
                // store requested URL to session - will load once logged in
                $data = array('redirect' => current_url());
                $this->session->set_userdata($data);
            }

            redirect('login');
        }

        // prepare theme name
        $this->settings->theme = strtolower($this->config->item('private_theme'));

        // set up global header data
        $this
            ->add_css_theme( "{$this->settings->theme}.css" )
            ->add_js_theme( "{$this->settings->theme}_i18n.js", TRUE );

        // declare main template
        $this->template = "../../{$this->settings->root_folder}/themes/{$this->settings->theme}/template.php";
    }

}
  • Are you using Codeigniter? If so, it would be interesting to add the tag. The error is because the template does not exist. You have already made sure that it exists in the specified directory?

  • 2

    Your problem is quite likely to be this ../../ which exists at the beginning of the directory being assigned to $this->template. Check where exactly this file is template.php and fix this directory so that it points to the file.

  • I changed this ending to: // declare main template $this->template = "public_html/themes/private/template.php"; which is where exactly ta the template.php file

  • but still remains the same mistake

  • Paulo, the error has now become An Error Was Encountered Unable to load the requested file: public_html/themes/private/template.php

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.