Hi All!
Have been working on trying to pass a custom attribute back to the thisCurrentSlide object in Galleriffic.
Here is some of my block controller code in the block controller (modified)
function prepareImageArray(){$gallery_json=new stdClass();$gallery_json->meta=new stdClass();$gallery_json->meta->order=Array();$gallery_json->meta->orderPointer=0;$image_info=Array();foreach($this->imagesas$image){$tmp=$image;$f=File::getByID($image['fID']);$tmp['f']=$f;// Get approved version of file$fID=$image['fID'];$thisFile=File::getById($fID);$fv=$thisFile->getApprovedVersion();// Get BTS URL Attribute
function prepareImageArray(){$gallery_json=new stdClass();$gallery_json->meta=new stdClass();$gallery_json->meta->order=Array();$gallery_json->meta->orderPointer=0;$image_info=Array();foreach($this->imagesas$image){$tmp=$image;$f=File::getByID($image['fID']);$tmp['f']=$f;// Get approved version of file$fID=$image['fID'];$thisFile=File::getById($fID);$fv=$thisFile->getApprovedVersion();// Get BTS URL Attribute$ak=FileAttributeKey::getByHandle('bts_image_url');$attrVal=$fv->getAttribute($ak->getAttributeKeyHandle());$keyName=$ak->getAttributeKeyName();$tmp['bts_img_url']=$attrVal;//////////////////////////////////////////////////////////////////// Add file caption to tmp array$tmp['caption']=(array_key_exists('caption',$tmp)&&$tmp['caption']) ? $tmp['caption']:$f->getTitle();//Create a JSON entity from the file path$gallery_json->{$tmp['fID']}->src=$f->getRelativePath();//Create a JSON entity from the file caption$gallery_json->{$tmp['fID']}->caption=$tmp['caption'];// Add BTS URL to JSON$gallery_json->{$tmp['fID']}->bts_img_url=$tmp['bts_img_url'];//var_dump($gallery_json);$gallery_json->meta->order[]=$tmp['fID'];$image_info[]=$tmp;}$jse= Loader::helper('json');$this->set('gallery_json',$jse->encode($gallery_json));$this->set('images',$image_info);}
Has anyone got any tips on how to pick this up, maybe on the thisCurrentSlide object on the client?
The puzzling thing is it's not obvious how caption etc get back to the client -- is this using JSON or embedded in the DOM
Would really appreciate any tips
Kind regards
Prema
Hi Prema, it's actually quite simple the method used for passing in the title and description. You'll see a DIV tag for each image with a class of "image-titleg" or "image-descg". This is displayed. The view.php file checks if those attributes are set and controls the writing of this (line 92 - 111).
Hope this helps.
JB