Welcome Guest, Not a member yet? Register   Sign In
CI site no longer works with new host
#1

I recently switched web host and having tough time to get anything to work with the new web host.

I was with hostmonster and they were using PHP 5.4

I am now with Webserve and they use PHP 5.5.30

I don't know what changed, but I am using MY_Loader.PHP and it goes into loop whenever it is used.

I have enabled error logs and attached for your information.

I'm using smarty and it was working in PHP 5.4 but it keeps loading the smarty settings in PHP 5.5.30

Following is my MY_Loader.PHP that is in Appliation\Core folder
PHP Code:
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

/**
 * MY_Loader class extends the core CI_Loader class.
 *
 * @author    Eric 'Aken' Roberts <[email protected]
 * @link    https://github.com/cryode/CodeIgniter_Smarty
 * @version    1.0.0
 */
 
class MY_Loader extends CI_Loader {
    
    
/**
     * Replace the default $this->load->view() method
     * with our own, so we can use Smarty!
     *
     * This method works identically to CI's default method,
     * in that you should pass parameters to it in the same way.
     *
     * @access    public
     * @param    string    The template path name.
     * @param    array    An array of data to convert to variables.
     * @param    bool    Set to TRUE to return the loaded template as a string.
     * @return    mixed    If $return is TRUE, returns string. If not, returns void.
     */
    
public function view($template$data = array(), $return false)
    {
        
// Get the CI super object, load related library.
        
$CI =& get_instance();
        
$CI->load->library('smartytpl');
        
        
// Add extension to the filename if it's not there.
        
$ext '.' $CI->config->item('smarty_template_ext');
        
        if (
substr($template, -strlen($ext)) !== $ext)
        {
            
$template .= $ext;
        }
        
        
// Make sure the file exists first.
        
if ( ! $CI->smartytpl->templateExists($template))
        {
            
show_error('Unable to load the template file: ' $template);
        }
        
        
// Assign any variables from the $data array.
        
$CI->smartytpl->assign_variables($data);
        
        
// Assign CI instance to be available in templates as $ci
        
$CI->smartytpl->assignByRef('ci'$CI);
        
        
/*
            Smarty has two built-in functions to rendering templates: display() 
            and fetch(). We're going to    use only fetch(), since we want to take
            the template contents and either return them or add them to
            CodeIgniter's output class. This lets us optionally take advantage
            of some of CI's built-in output features.
        */
            
        
$output $CI->smartytpl->fetch($template);
        
        
// Return the output if the return value is TRUE.
        
if ($return === true) return $output;
        
        
// Otherwise append to output just like a view.
        
$CI->output->append_output($output);
    }




I really appreciate your help

Thanks

Attached Files
.txt   log-2015-10-17.txt (Size: 20.57 KB / Downloads: 128)
Reply
#2

I also found out that it doesn't halt on errors, instead it redirects to main page
Reply
#3

(This post was last modified: 10-17-2015, 05:49 PM by John_Betong. Edit Reason: Spelling, not my forty :) )

Have you tried loading the default Welcome page without using Smarty?

Try creating another test page then gradually introduce database, Smarty, etc

It is far better to have something simple that works then introduce more features until it breaks.

When online error_reporting is disabled, try setting debug mode in index.php and also set your configure.php threshold to the maximum value of 4
Reply
#4

(10-17-2015, 01:17 PM)Jagarm Wrote: I also found out that it doesn't halt on errors, instead it redirects to main page

Try comment out the assignByRef line in your Loader because it was assigned in the Smartytpl.php


PHP Code:
        // Assign CI instance to be available in templates as $ci

        // $CI->smartytpl->assignByRef('ci', $CI); 
Reply




Theme © iAndrew 2016 - Forum software by © MyBB