06-11-2008, 03:13 AM
[eluser]abmcr[/eluser]
[quote author="jTaby" date="1212758338"]i had this functionality built into CodeExtinguisher. It was called 'extra_uri_segments' and they would be carried around the system until they were replaced. However, I deprecated that when query_strings were introduced since query_strings are a more robust solution.
But to answer your question. Don't forget that all the links that codex uses are set in codexcontroller:
etConfig() so if you want to modify them so that they always maintain the extra uri segments, it's very easy to do so. Here's what you would have to do:
1) Add $this->extra_uri_segment = implode('/',$this->uri->uri_to_assoc(3)); in codexcontroller:
etConfig()
2) Append .'/'.$this->extra_uri_segments to all the links and form actions in codexcontroller:
etConfig[/quote]
I have made this change as you suggest to setConfig
but if a set this url http://localhost:8888/lastcodex/backend.php/example/3 i get an error:I have also try to use a get request as http://localhost:8888/lastcodex/backend.php/example?id=3 but i get a 404 error page.... Where is my error... :red:
[quote author="jTaby" date="1212758338"]i had this functionality built into CodeExtinguisher. It was called 'extra_uri_segments' and they would be carried around the system until they were replaced. However, I deprecated that when query_strings were introduced since query_strings are a more robust solution.
But to answer your question. Don't forget that all the links that codex uses are set in codexcontroller:

1) Add $this->extra_uri_segment = implode('/',$this->uri->uri_to_assoc(3)); in codexcontroller:

2) Append .'/'.$this->extra_uri_segments to all the links and form actions in codexcontroller:

I have made this change as you suggest to setConfig
Code:
function setConfig($config){
$this->table = (isset($config['db_table']))? $config['db_table'] : show_error($this->lang->line('codex_table_not_defined'));
$this->form_setup = (isset($config['form_setup']))? $config['form_setup'] : show_error($this->lang->line('codex_form_not_defined'));
$this->controller_name = (isset($config['controller_name']))? $config['controller_name'] : show_error($this->lang->line('codex_controller_not_defined'));
$this->table_access_restriction = (isset($config['table_access_restriction']))? $config['table_access_restriction'] : array();
$this->order_by = (isset($config['order_by']))? $config['order_by'] : "";
$this->order_type = (isset($config['order_type']))? $config['order_type'] : "";
$this->page_header = (array_key_exists('page_header',$config))? $config['page_header'] : $config['controller_name'];
$this->template = (isset($_COOKIE['codex_template']))? $_COOKIE['codex_template'] : $this->config->item("codex_template");
$this->view_mode = (isset($_COOKIE['codex_view_mode']))? $_COOKIE['codex_view_mode'] : $this->config->item("codex_view_mode");
$this->rules = isset($config['rules']) ? $config['rules'] : array();
$this->on_one_page = isset($config['on_one_page']) ? $config['on_one_page'] : $this->config->item('codex_items_per_page');
$this->first_item = $this->getFirstItem();
$this->extra_uri_segment = implode('/',$this->uri->uri_to_assoc(3));
$this->add_link = (isset($config['add_link']))? $config['add_link'] : strtolower($this->controller_name).'/add'.'/'.$this->extra_uri_segments;
$this->edit_link = (isset($config['edit_link']))? $config['edit_link'] : strtolower($this->controller_name).'/manage/edit/{num}'.'/'.$this->extra_uri_segments;
$this->add_action = (isset($config['add_action']))? $config['add_action'] : strtolower($this->controller_name).'/execute_add'.'/'.$this->extra_uri_segments;
$this->edit_action = (isset($config['edit_action']))? $config['edit_action'] : strtolower($this->controller_name).'/execute_edit'.'/'.$this->extra_uri_segments;
$this->delete_action = (isset($config['delete_action']))? $config['delete_action'] : strtolower($this->controller_name).'/manage'.'/'.$this->extra_uri_segments;
$this->search_action = (isset($config['search_action']))? $config['search_action'] : strtolower($this->controller_name).'/search'.'/'.$this->extra_uri_segments;
$this->theme_chooser_action = (isset($config['template_chooser_action']))? $config['template_chooser_action'] : strtolower($this->controller_name).'/changeTemplate';
$this->view_mode_chooser_action = (isset($config['view_mode_chooser_action']))? $config['view_mode_chooser_action'] : strtolower($this->controller_name).'/changeViewMode';
$this->controller_link = (isset($config['controller_link']))? $config['controller_link'] : strtolower($this->controller_name);
$this->codexcrumbs->add($this->lang->line('codex_crumbs_home'));
$this->codexcrumbs->add($this->controller_link,$this->page_header);
$this->codexcrumbs->setSelected($this->page_header);
$this->codexadmin->_initialize($config);
$this->codextemplates->css('template-css',$this->config->item('codex_asset_folder').$this->template.'/css/codex_'.$this->template.'.css');
$this->codextemplates->jsFromAssets('js-framework','jquery.js');
$this->codextemplates->jsFromAssets('js-livequery','jquery.livequery.min.js');
}
Code:
Fatal error: Call to undefined method Example::3() in /Applications/MAMP/htdocs/lastcodex/codex/application/controllers/codexcontroller.php on line 36