How can id display from asset library?

Permalink
Good morning. Please anyone can help.

Block add or edit.php

<?php $al = Loader::helper('concrete/asset_library');

echo $al->file('thumbnail', 'thumbnailFileID', 'Select Thumbnail');
$thumbID = ?
echo $thumbID; ? how the file id can display ? etc id:33

?>

John

 
JSA1972 replied on at Permalink Reply
$("#thumbnail-fm-value").val() that can output id number from assest but how the javascript val gets onto php variable??
JSA1972 replied on at Permalink Reply
Any help would be most appreciated.
JohntheFish replied on at Permalink Reply
JohntheFish
Have a look at the code in the list files from set addon.

http://www.concrete5.org/marketplace/addons/list-files-from-set/...
JohntheFish replied on at Permalink Reply
JohntheFish
Then (Pseudocode):
// php
$id = ......
// script
<script>
var id = '<?php echo $id;?>';
// or
var id = parseInt('<?php echo $id;?>',10);
</script>
JSA1972 replied on at Permalink Reply
Thanks John but I was trying to different way.

Controller.php

public function thumbnail(){

$al = Loader::helper('concrete/asset_library');
$myThumbnail_a = $al->file('thumbnail', 'thumbnailFileID', 'Select Thumbnail');
$myThumbnail_b = File::getByID($thumbnail);

$myThumbnail_c = $myThumbnail_b->getVersion()->getRelativePath();

$thumb_post = $_POST['thumbnailFileID'];

return $myThumbnail_a;


}

edit.php

echo $controller->thumbnail();

I want to output two variable of $myThumbail_c and $thumb_post at edit.php. I think use array. Please give me for example.

Thanks
JohntheFish replied on at Permalink Reply
JohntheFish
I am sorry, I can't follow what you are trying to do.
JSA1972 replied on at Permalink Reply
Sorry I am no good English. Is it possible to return multiple values from a function?
JohntheFish replied on at Permalink Reply
JohntheFish
You can put the values into a keyed array, then return the array and access the values from their array keys.
return array('variable1' => $variable1, 'variable2' => $variable2);


You can also do a similar thing by creating and returning an object, then accessing the values object properties.