Accessing File Manager from Block for multiple files

Permalink 1 user found helpful
I'm a photographer. I built my website using concrete5. Currently I'm using Lightbox- based galleries for my portfolios, but it's time for a change and I've decided to use Manuel Masia's excellent "Camera" gallery on my concrete5 website.

For those who are interested, here is Manuel's site:

http://www.pixedelic.com/plugins/camera/#...

I was able to get this working based on an example from Remo Laubacher's "Concrete5 Beginner's Guide", see: Time for action – creating the FTP based picture gallery pg. 209.

Now I want to modify it further to use the File Manager to access groups of photos and be able to sort them, etc. I've looked at Andrew's video in the documentation (Advanced Block Development: Part Three), where he describes how to access the File Manager from a block. In this video, he says that to do it for multiple files (or images) it would be best to look at the Slideshow block that lives in
/concrete/blocks/slideshow, so that's where I am now.

I'll probably have a few questions as I go along, but my first one is:

in add.php and edit.php, what does the line:

$slideshowObj=$controller;

actually do? What does $slideshowObj actually refer to? I only ask because I don't see it anywhere else.

Any thoughts would be much appreciated. I'll post further questions as I go along.

Cheers,

Stu.

http://stuartlowe.com

 
Steevb replied on at Permalink Reply
Steevb
stuartlowe replied on at Permalink Reply
Thanks for your reply.

All of these add-ons that you've suggested look great.

I've used/purchased add-ons in the past and I'm sure I'll continue to do so.

This time, however, I'm keen to go through the exercise of building my own block.

I've got the block built in my dev environment and it works well. I just want to modify it so that it can utilize the functionality that is available by using the File Manager, and the slideshow block in core provides a good example of how to do it, just need to get my head around the code a bit and that's sort of where my initial question came from.

I'll keep chugging away on it.

Cheers,

Stu
webdewd replied on at Permalink Reply
webdewd
Hi Stu

I too am trying to build a block which requires multiple files. I tried the following code, but it doesn't work.

<?
    if ($fID > 0) {
   $fo = File::getByID($fID);
   if ($fo->isError()) {
       unset($fo);
   }
    }
    if ($fIDS1 > 0) {
   $social1 = File::getByID($fIDS1);
   if ($social1->isError()) {
       unset($social1);
   }
    }
    if ($fIDS2 > 0) {
   $social2 = File::getByID($fIDS2);



Did you have any luck pursuing this any further? You'd have thought this shouldn't be rocket science!

Paul
webdewd replied on at Permalink Reply
webdewd
I've figured it out. I was giving each file manager icon the same id, which equates to the same HTML id, hence when choosing an image the add/edit screen didn't populate the correct field with the file I'd chosen. Below is the correct code to choose 4 file managers. You have to make sure your db is set up with the correct number of fields to store the image id's. In the example below, these are fID fIDS1 fIDS2 and fIDS3.

<?
    if ($fID > 0) {
   $fo = File::getByID($fID);
   if ($fo->isError()) {
       unset($fo);
   }
    }
    if ($fIDS1 > 0) {
   $social1 = File::getByID($fIDS1);
   if ($social1->isError()) {
       unset($social1);
   }
    }
    if ($fIDS2 > 0) {
   $social2 = File::getByID($fIDS2);