Welcome Guest, Not a member yet? Register   Sign In
Please consider querystring support in 2.x

[eluser]pbreit[/eluser]
No it's not. It stinks. It's not readable at all. It's much less user friendly than the querystring version which actually indicates what the parameters are. And the user could easily edit them. And the querysting version is targetable with a <form>. And the querystring version is how *EVERY* search site does it. This is not user-firendly at all: "/products/search/call_of_duty/20/used/10/price/asc". Searches don't get picked up by Google so that doesn't matter, either.

[eluser]Ramania[/eluser]
About the search form, i use a very simple JS function that runs on almost any browser

Code:
[removed] = '<?=$this->config->site_url()?>icanremap/index/viewname/books/' + hdrSearchWhat  + '/' + hdrSearchTerm ;

you just reminded me of post! in the absence of JS, and it should also be called for once and later on with pagination it'll be passed along!

Code:
if (!empty($_POST))
{
//set only the search term since the rest of the functions would be defaulted!
}

so far none of my applications required very professional search since the content of my site is already displayed with listing and filtring ..

pbrei i started to think you have something "personal" against CI LOL.. anyways different people uses different approaches .. if you think your way is the best .. prove it with facts not with "google doesn't pick it" .. why would i want google to pick my search if the sitemap gives google everything i want google to get!

anyways .. good luck with your new choices.

[eluser]pbreit[/eluser]
I really like CI but the lack of query string support is maddening. Worse are the apologists like you who claim it is OK. No other framework has this restriction. The facts are that *every* search on the web uses queryatrings except CI sites. I don't know how much more proof you could possibly need.

[eluser]Ramania[/eluser]
[quote author="Ramania" date="1289840225"]
I don't want to debate the CI support for query string but i just want to add my two cents...
[/quote]

As i said earlier i am not here to debate how much CI supports query string! i just wanted to share! and dude, this is my personal opinion in you not related to CI or programming, you are a douchebag!

[eluser]pbreit[/eluser]
Just responding to your post. No need to call names.

[eluser]skunkbad[/eluser]
[quote author="Ramania" date="1289860172"]who said i use post? Tongue

Code:
function Index($viewName='def',$table=null,$searchWhat=null,$searchTerm='',$orderBy=null,$order=null,$limit='20',$offset='0')
[/quote]

So, this is fine for you. I just view a framework as something that is supposed to make something easier for me, and not necessarily something that puts restrictions on me. CI is good, but it seems that somebody got lazy or had opinions that made the decision to cripple $_GET. Honestly, I'm not going to stop using CI, because I have a work-around that works for me. I just think it's ridiculous. Would you do anything to defend CI? What if they said you couldn't use $_POST, and you could only use $_GET? What if they said they were now going to ASP because PHP is too trendy? I love CI, but I think anyone that uses it for more than a couple projects comes across the issue of $_GET being retarded. For instance, when I did a project about 6 months ago, I had to completely rewrite a Amazon store script because it used $_GET, and I hadn't yet figured out a solution for CI w/ $_GET. What a waste of time!

[eluser]The Questioner[/eluser]
I ran into this same problem when dealing with virtually any payment gateway. It seems as though all payment gateways use GET urls when retuning data back to your ecommerce site. It really annoys me that CI cannot enable both segment URIs and GET querystrings at the same time (for v1.7).

I eventually made some changes in the URI core class to enable simultaneous GET querystring and standard URI segments URLs (for CI v1.7.2). I understand that hacking the core is not ideal, but I didn't have time to wait for this critical feature to be part of a future official release.

I made the following changes in the core URI library

Code:
function _fetch_uri_string()
{

  if (strtoupper($this->config->item('uri_protocol')) == 'AUTO')
  {
  
   // If the URL has a question mark then it's simplest to just
   // build the URI string from the zero index of the $_GET array.
   // This avoids having to deal with $_SERVER variables, which
   // can be unreliable in some environments  
   if (is_array($_GET) && count($_GET) >= 1 && trim(key($_GET), '/') != '')
   {
    $this->uri_string=$this->ammend_url_with_get_vars(); //custom function added 24/4/2012
    return;
   }
  

   // Is there a PATH_INFO variable?
   // Note: some servers seem to have trouble with getenv() so we'll test it two ways
   $path = (isset($_SERVER['PATH_INFO'])) ? $_SERVER['PATH_INFO'] : @getenv('PATH_INFO');
   if (trim($path, '/') != '' && $path != "/".SELF)
   {
    $this->uri_string = $path;
    return;
   }
    

   // No PATH_INFO?... What about QUERY_STRING?
   $path =  (isset($_SERVER['QUERY_STRING'])) ? $_SERVER['QUERY_STRING'] : @getenv('QUERY_STRING');
   if (trim($path, '/') != '')
   {
    $this->uri_string = $path;
    return;
   }

   // No QUERY_STRING?... Maybe the ORIG_PATH_INFO variable exists?
   $path = str_replace($_SERVER['SCRIPT_NAME'], '', (isset($_SERVER['ORIG_PATH_INFO'])) ? $_SERVER['ORIG_PATH_INFO'] : @getenv('ORIG_PATH_INFO'));
   if (trim($path, '/') != '' && $path != "/".SELF)
   {
    // remove path and script information so we have good URI data
    $this->uri_string = $path;
    return;
   }  
  
   // We've exhausted all our options...
   $this->uri_string = '';
  }
  else
  {
   $uri = strtoupper($this->config->item('uri_protocol'));

   if ($uri == 'REQUEST_URI')
   {
    $this->uri_string = $this->_parse_request_uri();
    return;
   }

   $this->uri_string = (isset($_SERVER[$uri])) ? $_SERVER[$uri] : @getenv($uri);
  }

  // If the URI contains only a slash we'll kill it
  if ($this->uri_string == '/')
  {
   $this->uri_string = '';
  }
}

I then added some additional functions

Code:
function ammend_url_with_get_vars()
//custom function to force convert any GET variables into standard id/value URIs pairs
//and then remove GET variables from URL path
{  
  //retrieve current URL (sans base path)
  $path=$this->curPageURL(TRUE);
  
  //remove GET values from url
  list($path,$querystring) = array_pad(explode('?', $path, 2), 2, null);
    
  //cycle thru each GET variable
   foreach ($_GET as $key => $value)
  {
   //append to end of URL as id/pair URI
   $path.='/'.$key.'/'.$value;
  
  };  
  
  //return ammened URL path
  return $path;

}

function curPageURL($boolRemoveBasePath=FALSE)
//get current page URL
{
  $pageURL = $_SERVER['HTTPS'] == 'on' ? 'https://' : 'http://';
  $pageURL .= $_SERVER['SERVER_PORT'] != '80' ? $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"] : $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
  $pageURL = preg_replace('/:[0-9][0-9][0-9]/', '', $pageURL);

  //do we remove the base path?
  if ($boolRemoveBasePath)
  {
   //remove using HTTPS base path and then using HTTP base path
   $pageURL = str_replace($this->config->item('base_url_secure'),'', $pageURL);
   $pageURL = str_replace($this->config->item('base_url'),'', $pageURL);
  };
  
  return $pageURL;
}

Basically this hack collects any GET data, converts them into id/value pairs, and then adds these as additional URI segments to the URL. The querysting section of the URL is then removed.

For example, the mixed URL

Code:
www.yoursite.com/controller/function?datavar1=dataval1&datavar2=dataval2

gets transformed to

Code:
www.yoursite.com/controller/function/datavar1/dataval1/datavar2/dataval2

This allows you to leverage existing CI URI functions to extract the GET values.

I hope this helps some of you fellow coders out.




Theme © iAndrew 2016 - Forum software by © MyBB