Welcome Guest, Not a member yet? Register   Sign In
Basic CMS for CodeIgniter applications
#4

[eluser]Berik[/eluser]
you could have a "page" method within your controller that loads a template view and pass the inner html file as an argument to the method.

for example

-------------------------------------------------

(in controllerName):

function page($html_file_to_load)
{
...
check to see if file exists on server, if not show 404 page or redirect to homepage

// if the contents are outside the app directory
$the_contents = file_get_contents($html_file_to_load);

// if the contents are in the view directory
$the_contents = $html_file_to_load;

$data['html_content'] = $the_contents;
$this->load->view('pages_template', $data);
}

-------------------------------------------------

(in application/views/pages_template.php):

header stuff (doctype and other stuff)
site header html
<?php echo $html_content; ?>
site footer html

-------------------------------------------------

(in application/config/routes.php for nicer urls):

$route['(:any)'] = "controllerName/page/$1";


Messages In This Thread
Basic CMS for CodeIgniter applications - by El Forum - 03-11-2010, 09:48 PM
Basic CMS for CodeIgniter applications - by El Forum - 03-11-2010, 10:43 PM
Basic CMS for CodeIgniter applications - by El Forum - 03-11-2010, 10:58 PM
Basic CMS for CodeIgniter applications - by El Forum - 03-12-2010, 03:06 AM
Basic CMS for CodeIgniter applications - by El Forum - 09-17-2010, 02:30 AM
Basic CMS for CodeIgniter applications - by El Forum - 09-17-2010, 06:44 AM
Basic CMS for CodeIgniter applications - by El Forum - 09-17-2010, 07:17 AM
Basic CMS for CodeIgniter applications - by El Forum - 09-17-2010, 07:19 AM
Basic CMS for CodeIgniter applications - by El Forum - 09-17-2010, 07:22 AM



Theme © iAndrew 2016 - Forum software by © MyBB