Controller function for all views
Hi Fuel forum, something I was wondering about. The code below represents a function that allows me to create a new view from the CMS. This code is in the controller that my website uses.
function funjetvalentinesdaysale() {
$data = array();
$data['my_custom_content'] = '';
$data['view'] = 'funjetvalentinesdaysale';
$page_init = array('location' => 'funjetvalentinesdaysale', 'render_mode' => 'cms');
$this->load->module_library(FUEL_FOLDER, 'fuel_page', $page_init);
$this->fuel_page->add_variables($data);
$this->fuel_page->render();
}
In my website, the above code structure is used every time I want to create a new view. This website has over 30 views, so try to imagine 30+
function whatever() {
// Do stuff here
}
My question is would it be possible to write a kind of universal function that would eliminate my need to write a function for every view I make? Appreciate the help in advance.
Comments
Example url: http://20023474.travsearch.com/fuel/travel
The number where the www should be is a number assigned to a travel agent. Without a number in place of www, Codeignitor and Fuel doesn't know what to load and reverts to an error page.
http://ellislab.com/codeigniter/user-guide/general/controllers.html#remapping