Welcome Guest, Not a member yet? Register   Sign In
Help! adding a question mark when enabling query string
#1

[eluser]7amza[/eluser]
Hey,
i need to use the query string and the uri segment (mixing) ..
so i do some searchs and i find the solution (active the query string and set uri_segment to path info) .
but there is a problem , all my anchors and forms doesn't works anymore and the problem is the question mark wich codeigniter add automatically when using anchor() and form helper .

the previous link(wich works) is :
anchor('controller/function/params') produce http://domain.com/controller/function/params/
after enabling query string the url is :
anchor('controller/function/params/?params=goeshere') produce http://domain.com/?controller/function/?params=goeshere
so i need really to prevent CI from adding a question mark automatically when using anchor() and form helper .
#2

[eluser]Eric Barnes[/eluser]
If you are using the latest release Reactor v2 then you can turn off enable_query_strings and then use the allow_get_array which will work as you describe. Otherwise you may have to over ride the anchor helper and change it manually.
#3

[eluser]7amza[/eluser]
hey eric ,
i'm usign CI 2.0 i downloaded it from the BitBucket two or three weeks ago .
i don't have any config item with this name (allow_get_array) .
where can i download the latest release Reactor v2 ?
#4

[eluser]Eric Barnes[/eluser]
You can get it via the downloads page http://codeigniter.com/downloads/
#5

[eluser]Unknown[/eluser]
I had this problem too. I had to override the core "Config" class. Here is my "MY_Config" for those who have the same problem :

Code:
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class MY_Config extends CI_Config{
/**
  * Site URL
  * Returns base_url . index_page [. uri_string]
  *
  * @access public
  * @param string the URI string
  * @return string
  */
function site_url($uri = '')
{
  if ($uri == '')
  {
   return $this->slash_item('base_url').$this->item('index_page');
  }

  if ($this->item('enable_query_strings') == FALSE)
  {
   $suffix = ($this->item('url_suffix') == FALSE) ? '' : $this->item('url_suffix');
   return $this->slash_item('base_url').$this->slash_item('index_page').$this->_uri_string($uri).$suffix;
  }
  else
  {
   if(substr($uri,0,1)=='/')$uri = ltrim($uri,'/');
   return $this->slash_item('base_url').$this->item('index_page').$this->_uri_string($uri);
  }
}

}




Theme © iAndrew 2016 - Forum software by © MyBB