HELP!!!!GET is not working!!!

#1
[eluser]pokerking[/eluser]
hi,

At first CI was breeze to start with. Then i start to have problems. I am converting my project from zend framework to codeigniter for various reasons. I am at present stuck at GET query string.

Here is the issue.

Segments is working fine

http://localhost:81/admin/searchsubmit/page/2


it goes to my admin controller and searchsubmit method.

i can get the page values using segment method

but also i need this to work.

http://localhost:81/admin/searchsubmit?page=2&.... very long search string....

My $_GET('page') returns null. It seems like page is not exist in GET array.

This is my .htaccess

# Turn on the Rewrite Engine
Options +FollowSymLinks
RewriteEngine On


# If the file or directory exists, show it
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d


RewriteRule ^(.+) - [PT,L]

# Blank queries get sent to the index
RewriteRule ^$ index.php? [L]

# All other queries get sent to the index as index.php/whatever
RewriteRule ^(.*)$ index.php?/$1 [L]

=======================================================================

I modified CFI_INPUT class so it does n't reset my GET varaibles.

$this->allow_get_array=TRUE;
before
$this->_sanitize_globals();

I think problem is with URL (.htaccess) ...

I wanted to maintain same segment approach and GET query string just the way it worked in zend framework. No compormise in this!.

I never had problems with zend framework... I am trying to move to CI because it is small. Now i have this problem.

i went thru this forums...it seems like hack is working for evreyone except me.

Also PATH_INFO returns nothing when i used in $config['uri_protocol']

I am using windows.

your help is appreciated.!!

#2
[eluser]pokerking[/eluser]
I just managed to work in hack way.

When i call query URL , i add index.php in the beginning.

http://localhost:81/admin/searchsubmit?page=2&....

to

http://localhost:81/index.php/admin/searchsubmit?page=2&....

it works but it is ugly. I did n't have to do this in zend framework. I have to dig deep on all this source code to figure it out and make it work like zend framework(no index.php 0- .htaccess take care of that).

i think the secret is in .htaccess. I have to figure it out how to add index.php in all URLs indirectly to get GET parameters.

#3
[eluser]wiredesignz[/eluser]
Sorry to say this, but I think you are way off track.

Try using $this->input->get('page'); after you have set $config['enable_query_strings'] = TRUE;

#4
[eluser]GSV Sleeper Service[/eluser]
add [QSA] to your rewrite rules.

from the mod_rewrite docs - http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html

'qsappend|QSA' (query string append)
This flag forces the rewrite engine to append a query string part of the substitution string to the existing string, instead of replacing it. Use this when you want to add more data to the query string via a rewrite rule.

[edit] actually, after reading wiredesignz comment I don't think you need to do this.

#5
[eluser]pokerking[/eluser]
wiredesignz,

NO. That is not working. Tried it. Nothing in the GET array!.
Without index.php in the URL , there is no GET data.

I had to explicitly use index.php in URL to get the stuff working. I never do that in zend framework. Always same url except additional "?" for query string.

if someone figured out using same segment url in query string , let me know.

My first call to search method

http://localhost:81/admin/searchsubmit/page/1

subsequent calls for next , prev , last , first

http://localhost:81/index.php/admin/searchsubmit?page=2


All i want is remove index.php from all urls.

Thanks.

#6
[eluser]Pascal Kriete[/eluser]
Just a wild guess, but I think it might be that you have two ?'s in your url with your .htaccess.

Try changing it to:
Code:
# Turn on the Rewrite Engine
Options +FollowSymLinks
RewriteEngine On


# If the file or directory exists, show it
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d

RewriteRule ^(.+) - [PT,L]

# Blank queries get sent to the index
RewriteRule ^$ index.php [L]

# All other queries get sent to the index as index.php/whatever
RewriteRule ^(.*)$ index.php/$1 [L]

EDIT: Looked it up. According to RFC 3986
Quote:The query component is indicated by the first question mark ("?") character and terminated by a number sign ("#") character or by the end of the URI.

#7
[eluser]wiredesignz[/eluser]
It does work for me, see attached profiler image:
Code:
//.htaccess
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond $1 !^(index\.php|gallery|img|pdf|css|js|flash|font|user_guide|robots\.txt|favicon\.ico)
    RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

//url
http://127.0.0.1/inktype/blog/page?title=my-page

#8
[eluser]pokerking[/eluser]
Not working man. I am using windows vista , fastcgi.

This is what i use in zend framework...same thing not working in codeigniter

Options +FollowSymlinks +ExecCGI
RewriteEngine on
RewriteBase /
RewriteRule !(.*)\.(css|js|ico|gif|jpg|png|txt|zip|gz|xml|pdf|pl|cgi|doc|html|swf)$ index.php

Some other problem with codeigniter. It needs explicit index.php in the url for windows fast cgi installation.

Unless someone comes with a .htaccess that works in windows fastcgi.

Advanced thanks.

#9
[eluser]John Fuller[/eluser]
Sorry, this is not helpful but I don't see why you don't just use segments. By the time you have figured out how to get around your problem you probably could have rewritten the app to get away from using Get. The developers would not have removed the functionality if they thought you couldn't do without it. Interestingly, I don't see many complaints about missing GET though I'm sure a forum search would dig up a few.

By the way, comparing CodeIgniter to the Zend Framework is comparing apples to oranges because the Zend Framework is more like a loose collection of libraries (like Pear) than a traditional framework. You don't really have a framework but rather a selection of libraries to build your own framework.

#10
[eluser]pokerking[/eluser]
I like segment concept upto routing to a method. I do not like to handle data through segmentation. Also i use controller to route further. It is easier for me to maintain if do most my code in my own business classes. So i do not use any controller methods. So get and post is the way , i auotmate my form to business objects mapping. There are many reasons you need GET. Try to simplify things by restricting framework is not a good idea. i can't say about others but i like when i have more options not feeling restricted by a framework!.
I am still novice in CI as i am rearchitecting my existing code base with CI. It will take another 1 month for me to understand all good thing about CI. One thing about CI is , it is transparent and fast. There are many hurdles still. It is more of me understanding what this framework can do and can't do. Thanks!.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.