Welcome Guest, Not a member yet? Register   Sign In
Error in Codeigniter template 1.4, Your template.php file does not appear to contain a valid configuration array.
#1

[eluser]briskdeveloper[/eluser]
Hi All,

I’m running PHP 5.2 and CI 1.7.2 with only the Template library installed. No matter what I put in the Template config file I keep getting the error "Your template.php file does not appear to contain a valid configuration array."

Am just following the CodeIgniter user guide for "Template Library for CodeIgniter, the PHP Framework".

Couldn't make out why this error is appearing, I tried all options but no luck.

Has any one tried this, plz guide me.


Thanks,
Shakeeb
#2

[eluser]InsiteFX[/eluser]
POST YOUR CODE!

Enjoy
InsiteFX
#3

[eluser]Colin Williams[/eluser]
Specifically, show us config/template.php
#4

[eluser]briskdeveloper[/eluser]
Hi,

Ok following are my code,

application/config/template.php

<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
$template['active_group'] = 'default';
$template['default']['template'] = 'template';
$template['default']['regions'] = array(
'header',
'title',
'content',
'sidebar',
'footer',
);

$template['default']['regions']['header'] = array('content' => array('<h1>CI Rocks!</h1>'));
$template['default']['regions']['footer'] = array('content' => array('<p id="copyright">© Our Company Inc.</p>'));


application/controllers/temp.php

class Temp extends Controller {

function Temp()
{
parent::Controller();
}

function index()
{
$this->template->load();
}

I have also autoloaded the library file i'e template.php

When I run its showing the following error,
An Error Was Encountered
Your template.php file does not appear to contain a valid configuration array.



Thanks,
Shakeeb
#5

[eluser]Colin Williams[/eluser]
It all looks good on first glance. I would go into the Template class constructor, where this error is generated, and do some debugging. Please report back what you find.

I have tested Template on 1.7.2 pretty thoroughly, and can't seem to re-produce your error.
#6

[eluser]briskdeveloper[/eluser]
I tried many times by changing files and using codeigniter 1.7.1, but no luck am not geeting what is the exact problem. can u suggest me vr and wat changes I need to make, to get it done.
#7

[eluser]Colin Williams[/eluser]
My suggestion is that you go into the Template class constructor where the error is generated and debug the issue. Short of coming to you home or office personally, that's all I can do to help you Smile
#8

[eluser]briskdeveloper[/eluser]
Thanks,
any time you can come to my home vl have lunch or dinner together.
#9

[eluser]briskdeveloper[/eluser]
hey following is my template class constructor, it seems everything ok

function CI_Template()
{
// Copy an instance of CI so we can use the entire framework.
$this->CI =& get_instance();

// Load the template config file and setup our master template and regions
include(APPPATH.'config/template'.EXT);
if (isset($template))
{
$this->config = $template;
$this->set_template($template['active_template']);
}
}
#10

[eluser]briskdeveloper[/eluser]
Finally, is thr any one experience enough who can fix the above error, as am new to this codeigniter I tried all possibilites with best effort but couldn't fix it.

Or else I should follow the good old methods.




Theme © iAndrew 2016 - Forum software by © MyBB