pass an extra variable with g2_itemId

pathway

Joined: 2004-07-22
Posts: 11
Posted: Fri, 2011-04-08 16:51

Hello,

can i pass an extra variable with g2_itemId, so the link to image would be like this:

http://localhost/test_site/gallery2/main.php?g2_itemId=688&g2_rt_d=$_GET[ "rt_id"]

thank you in advance

john

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Sat, 2011-04-09 13:08

you can pass whatever you want, but gallery will only interpret and process the $_REQUEST variables it has been programmed to use.
You'd have to add your own logic for whatever $_GET[ "rt_id"] is.

The easiest way would be to embed gallery into a page and have the page process your custom $_REQUEST variables or write a gallery module to handle them.
For instance in this example I use a variable for setting the theme dynamically:
http://www.flashyourweb.com/gallery2/embed_samples/gallery_embed_template.php?g2_itemId=24203&g2_theme=matrix
http://www.flashyourweb.com/gallery2/embed_samples/gallery_embed_template.php?g2_itemId=24203&g2_theme=clear
http://www.flashyourweb.com/gallery2/embed_samples/gallery_embed_template.php?g2_itemId=24203&g2_theme=carbon

I also use jQuery to append my extra variable ;)

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Sun, 2011-04-10 11:17
Quote:
You'd have to add your own logic for whatever $_GET[ "rt_id"] is.

You don't have to go quite that far.
You can use galleryUtilties::getFormVariables(...) to get the values; that means the data you get is already sanitised and safe. Obviously you have to write the code to use that data.

 
pathway

Joined: 2004-07-22
Posts: 11
Posted: Mon, 2011-04-11 07:54

Thank you for your help,

i will try and come back again