EllisLab text mark
Advanced Search
     
Plugin: GET/POST Parameters
Posted: 17 September 2009 10:26 PM   [ Ignore ]
Avatar
Joined: 2007-02-16
408 posts

A simple plugin to print out any get or post params from a form.

Print a single parameter:
{exp:parameters:get name=“job_id”} or {exp:parameters:post name=“job_id”}

Print multiple parameters:

{exp:parameters}
    {get_job_id}
    {get_foobar}
{
/exp:parameters} 

Loop through a parameter that is an array:

{exp:parameters}
    
<ul>
    
{post_foobar}
        
<li>{key} {value}</li>
    
{/post_foobar}
    
</ul>
{/exp:parameters} 

Biggest difference is the only way to get multiple parameters is to use the tag pair. You can add parse=“inwards” to the tag par if you have trouble with the parsing order.

There is a parameter “flatten_arrays=‘yes’”, which will take something like $_POST[‘key’] => ‘value’ and return the following: post_key_value. What purpose that might have to someone, I don’t know, but I added it when I was experimenting/having trouble with a form.

Latest version is 1.3

File Attachments
pi.parameters.php.zip  (File Size: 3KB - Downloads: 472)
 Signature 

@litzinger
Bold Minded add-ons

 
Posted: 29 September 2009 07:45 AM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Avatar
Joined: 2002-10-08
256 posts

Thanks for this, I found it very useful.

 
Posted: 01 October 2009 11:13 AM   [ Ignore ]   [ # 2 ]   [ Rating: 0 ]
Avatar
Joined: 2007-02-16
408 posts

Edited

 Signature 

@litzinger
Bold Minded add-ons

 
Posted: 02 October 2009 10:28 AM   [ Ignore ]   [ # 3 ]   [ Rating: 0 ]
Avatar
Joined: 2007-02-16
408 posts

Updated the plugin to 1.2. Separated the things out into different methods to avoid parsing issues when using the single variable, and variable pair in the same template. Download latest at URL in original post.

 Signature 

@litzinger
Bold Minded add-ons

 
Posted: 07 October 2009 11:09 PM   [ Ignore ]   [ # 4 ]   [ Rating: 0 ]
Joined: 2009-05-22
5 posts

Hi.  I am unable to get this plugin to work (Exp 1.6.8 on plugin version 1.2).  I get a “Notice: Undefined variable: v in xxxx/www/public_html/admin/plugins/pi.parameters.php on line 66” error.

Test commands used are:

{exp:parameters:get name="screen_name"}
{exp
:parameters:get name="test"

Each was presented with a get query of the following, respectively:

http://localhost/community/members/?screen_name=jsmith
http://localhost/community/members/?screen_name=test 

David

 
Posted: 08 October 2009 10:11 AM   [ Ignore ]   [ # 5 ]   [ Rating: 0 ]
Avatar
Joined: 2007-02-16
408 posts

Yep, there was an undefined variable. Try downloading it again, or change line 65 from this:

if($name and $IN->GBL($v'GET')) 

to this:

if($name and $IN->GBL($name'GET')) 
 Signature 

@litzinger
Bold Minded add-ons

 
Posted: 28 October 2009 11:33 PM   [ Ignore ]   [ # 6 ]   [ Rating: 0 ]
Avatar
Joined: 2008-06-26
262 posts

Can you post some sample code to show how this plugin actually works WITHIN a typical form setup / tags? I’ve been mucking around with this and I can’t get it work at all.

Also, could this plugin be used to pass a parameter from one page to another via the URL?

Cheers,
Nik

 Signature 

nickfoxall.com | ExpressionEngine Development in Hong Kong

 
Posted: 26 November 2009 10:28 AM   [ Ignore ]   [ # 7 ]   [ Rating: 0 ]
Avatar
Joined: 2009-01-06
13 posts

hello, nice plugin, but shouldn’t this work?

http://www.domain.com/template/article/?var=test 

this returns nothing in my templates. however:

http://www.domain.com/template/article/&var=test 

does. is there a way to GET vars that are added to the url by questionmark ?

 
Posted: 30 December 2009 04:57 PM   [ Ignore ]   [ # 8 ]   [ Rating: 0 ]
Avatar
Joined: 2008-07-14
684 posts

I am trying to use this in the forgot password form.

So I put this within the form

<input type="hidden" name="forgot_password_variable" value="true">
{exp:parameters post="forgot_password_variable"

Then in the specialty template: user messages, I put this code in to detect it

{exp:parameters:get name="forgot_password_variable"

it does not recognize it at all. From the previous responses, it was not clear how you actually implement this with a form.

Any help is appreciated.

 
Posted: 19 January 2010 11:56 PM   [ Ignore ]   [ # 9 ]   [ Rating: 0 ]
Avatar
Joined: 2006-01-14
350 posts

Seems like Brian’s site is down, and going through google cache reveals the file doesn’t exist on the server…

Would be really useful to have this plugin just now smile

 Signature 

Weblog | @iain | Taxonomy for EE2

 
Posted: 01 March 2010 04:45 PM   [ Ignore ]   [ # 10 ]   [ Rating: 0 ]
Avatar
Joined: 2008-08-08
78 posts

Can’t seem to get his working with the {exp:query}

Eg.

{exp:parameters}
{get_search_input}
{exp
:query sql="SELECT *
                FROM exp_weblog_titles
                WHERE weblog_id = 2
                AND title LIKE '{get_search_input}'"
}

<ul>
{exp:weblog:entries entry_id="{entry_id}"}
    
<li>{title}</li>
{/exp:weblog:entries}
</ul>

{/exp:query}
{
/exp:parameters} 

I’ve tried this:

AND title LIKE '%{get_search_input}%'"} 

this:

AND title LIKE '%"{get_search_input}"%'"} 

and this:

AND title LIKE '%%{get_search_input}%%'"} 

Still can get the nesting to work.

Any ideas?

 Signature 

EE 2.2.1

 
Posted: 01 March 2010 06:50 PM   [ Ignore ]   [ # 11 ]   [ Rating: 0 ]
Avatar
Joined: 2007-02-16
408 posts

Try adding parse=“inward” to the parameters tag.

 Signature 

@litzinger
Bold Minded add-ons

 
Posted: 02 March 2010 12:31 AM   [ Ignore ]   [ # 12 ]   [ Rating: 0 ]
Avatar
Joined: 2008-08-08
78 posts

Worked like a charm! thanks a ton litzinger!

 Signature 

EE 2.2.1

 
Posted: 03 June 2010 01:33 PM   [ Ignore ]   [ # 13 ]   [ Rating: 0 ]
Avatar
Joined: 2008-07-14
684 posts

I am unsure on how this works.

I have a SAEF, that returns to /post/thankyou

{exp:weblog:entry_form 
    weblog
="ajax_form" 
    
return="/post/thankyou" 
    
status="Open"

So I put {exp:parameters:post name=“title”} within that template, then within the /post/thankyou template I’ve tried the following to get the title value this plugin is suppose to post

{exp:parameters:get name="title"

and

<?php print $_GET['title']?> 

neither gets the posted variable title that the plugin posts

 
Posted: 09 June 2010 05:56 PM   [ Ignore ]   [ # 14 ]   [ Rating: 0 ]
Joined: 2008-06-01
56 posts

Same problem here. Plugin doesn’t seem to work with SAEF submitting?