[eluser]Robert May[/eluser]
Not entirely sure why, but this is the code I'm trying to run. The array_merge() works fine and outputs the correct array set. I think the problem has something to do with the content I'm loading via a view.
My Templater library:
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Templater {
var $data_array = '';
function Build($data)
{
$CI =& get_instance();
$CI->load->library('parser');
// Provide defaults
$data_array = array(
'website_name' => 'iMayges',
'page_title' => 'Page Not Found',
'subheading' => 'This page could not be found',
'content' => 'Please go back and try again, or report this error via the contact email address.',
'latest_blog_posts' => '',
'latest_gallery_image' => '',
'get_in_touch' => '',
'copyright_notice' => '',
);
// Should overwrite default values if they exist
$data = array_merge($data_array, $data);
// Build the latest blog posts etc here
$data['latest_blog_posts'] = '';
$data['latest_gallery_image'] = '';
$data['get_in_touch'] = '';
$CI->parser->parse('site_template', $data);
}
}
The relevant controller:
Code:
function index()
{
$this->session->keep_flashdata('refer');
$content = $this->load->view('auth', '', TRUE);
$data = array(
'page_title' => 'Login',
'subheading' => 'Please login to continue',
'content' => $content,
);
$this->templater->build($data);
}
The auth view:
Code:
<?
$attributes = array(
'id' => 'loginform'
);
echo form_open('auth/login', $attributes);
?>
<ul id="loginform_list">
<li>Your username or email address: <input type="text" name="author_name" id="login_textbox" maxlength="100" size="20" value=""/></li>
<li>Your password: <input type="password" name="author_password" id="login_textbox" maxlength="100" size="20" value=""/></li>
<li><input type="submit" name="loginbutton" value="Login" id="loginbutton"/></li>
</ul>
</form>
Basically, when you try to run it, the page won't load and the server appears to go down. Has it got something to do with how it's passing the content data, or the content data itself?
Many thanks for any advice.