Background
Robin has done a lot of this work for you already by creating a little known about extension which basically creates a dropdown menu in the publish page- options are the gallery categories- select one and the category id is entered into the field. Saves having to flip over to the gallery and look it up and adding gallery tags inside a weblog tag which will add to you queries.
Custom Field
Create a custom field with input text as type and give it a name like {gallerycategory}. On your field group pahe which list your custom fields, hover your mouse over the field you created and look at the stats bar below which gives a long url and at the very end is your field_id. Make note of that.
Download the extension here. Be sure to change the 2 items mentioned
You’ll need to open up the extension- and on line 33 alter:
$alter_field = 32;
The number? That should be the field id of the text field where you want the category id to be inserted. That field will be ‘replaced’ on the user side by a dropdown filled with the category names.
On line 37 you’ll need to alter:
$results = $DB->query(“SELECT cat_id, gallery_id, cat_name FROM exp_gallery_categories WHERE gallery_id=2 ORDER BY cat_name”);
Change gallery_id=2 to equal the id number of whatever gallery you want to pull the categories from.
Change it, save it, upload it to the extensions folder- then enable the extension.
The Template
Follow the tutorial at .(JavaScript must be enabled to view this email address) at 5pieces
and in your SWFobject code replace
fo.addVariable("xmlfile", "http://www.somesite.com/index.php/gallery/images/?album_id=<?php echo $cat_id;?>");
with
fo.addVariable("xmlfile", "http://www.somesite.com/index.php/gallery/images/?album_id={gallerycategory}");
You can see it working here