Sending data to a single page through a controller

Permalink
Hello all

I hope this hasn't already been covered, if so I apologise and please point me in the right direction. I have a thumbnail gallery which has hyperlinks configured to pass the fileID to a single page to display the image and more information about it contained in custom attributes. I have no problem with retrieving and displaying the information on the single page.

What I am struggling with is the controller element, where the controller element needs to be located and how it receives the parsed data through the URL.

This is what my thumbnail gallery sends to single page
a href="<?=URL::to('/store/shop_image', 'fid', $fileID)?>">


Firstly I am confused as to the location of the controller for my single page. The path for my single page is '/store/shop_image', do I put the controller.php file in the same location as the single page or does it go in the 'application/controllers' folder? If the 'application/controllers' folder then does it need to be at the same level as the path for the single page i.e. 'application/controllers/store/shop_image'?

Secondly, what should I have inside the controller.php file? should it be
<?php
namespace Application\Controller\SinglePage\Store\ShopImage;
use Concrete\Core\Page\Controller\PageController;
class Media extends PageController
{
   public function fid($fid = null)
   {
   }
}


I hope you can put me right as this has been bugging me for days...

dclmedia