Welcome Guest, Not a member yet? Register   Sign In
[Q] passing parameters with question mark
#1

[eluser]vlad_ci[/eluser]
Hi, I tried to search before posting,however my search keys are to vague, because I am not sure how to ask this:

Basically I am using Dojo javascript toolkit and their Service Method definition framework (SMD) to invoke Codeigniter's controllers.

Everything works fine, I would like now to start passing data as arguments
to the controllers (instead of looking them up in the _REQUEST array).

To do that, I first changed my ajax calls to use what is called 'URL' envelope
meaning that the request is generated as a URL

So dojo generates me this

https://XYZ.com/wf_collateral?rqkey=2&wh...npCallback


my 2 parameters are: rqkey and 'whatdata'
the third parameter the name of the function call back dojo creates automagically
(because it is a JSONP call).
and this is fine.

But codeigniter accepts the parameters to be <controller_method_name>/parm1/parm2/.../parmN


while I see that Dojo's string is
?rqkey=2&whatdata=7777&callback=dojo.io.script.jsonp_dojoIoScript1._jsonpCallback


I wanted to ask -- should I take in one argument and just use PHP's 'explode' to get
them all -- or is there a more 'standard' way (I am having difficulties getting dojo
to construct the url string exactly as codeigniter expects)

Is the first question mark in the paramete string indicative of something?


thank you in advance.
#2

[eluser]abmcr[/eluser]
You can activate the query string

$config['enable_query_strings'] = TRUE;

as write in the user guide http://ellislab.com/codeigniter/user-gui.../urls.html
#3

[eluser]Flipside Tech[/eluser]
Is there any way to do both segment and query string URLs?

I much prefer the segment approach, there are some incoming links to my site that have a query string added. For example, google analytics tracking.
#4

[eluser]Flipside Tech[/eluser]
Solved:

$config['uri_protocol'] = "PATH_INFO";
$config['enable_query_strings'] = TRUE;
#5

[eluser]junmin Liu[/eluser]
NO, THAT DOESN'T HELP.

I really want this search engine friendly url:

/view/mike/what do you want?

not this url: /view?username=mike&title=what do you want?

please help. thanks a lot
#6

[eluser]watanuki[/eluser]
Code:
$config[‘uri_protocol’]  = “PATH_INFO”;
$config[‘enable_query_strings’] = TRUE;

thank you very much... That's really help.. Big Grin
#7

[eluser]Dr. Seuss[/eluser]
I'm trying to get this working on GoDaddy. I began by following these directions: http://codeigniter.com/wiki/Godaddy_Installaton_Tips/

So, my relevant config changes were:

Code:
$config['uri_protocol']    = 'QUERY_STRING';  
$config['index_page'] = 'index.php?';
$config['enable_query_strings'] = TRUE;

.htaccess is:

Code:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?$1 [L]

I have tried both the values above and:
Code:
$config['uri_protocol']    = 'PATH_INFO';

...as suggested in this thread and I cannot get my callback function to be handled correctly. I get:

Quote:Undefined index: callback

for a request structured similar to:

Code:
http://esc.getthere.co/ajx/getthere_dfcn?callback=?

Has anyone encountered this problem and managed to discover a solution?

Seuss




Theme © iAndrew 2016 - Forum software by © MyBB