Image/File Attribute :: Getting Relative Path

Anyone run into this issue and have some advice?

Fatal error: Using $this when not in object context in /home/envision/public_html/updates/concrete5.4.1.1/concrete/blocks/library_file/controller.php on line 49

I'm passing page ID's via ajax to a script that loops through the pID's and pulls the relative path of the specified image/file attribute for that collection. It works fine for standard Attribute Values, but for some reason I am unable to get it to work for the file attributes.


View Replies:
avannoord replied on at Permalink Reply
Oh, and here's my code:
foreach ($_POST['plans'] as $planID) {
   $po = Page::getByID($planID);
   $lfb = LibraryFileBlockController::getFile($po->getAttribute('sell_sheet')->fID);
   if(is_object($lfb)) {
      echo DIR_REL.$lfb->getRelativePath();
avannoord replied on at Permalink Reply
*UPDATE* Got it workin'.
Here's the code that did it:
$po = Page::getByID($planID);
   $filepath = $po->getAttribute('sell_sheet')->getVersion()->getRelativePath();
   if(!empty($filepath) || $filepath !== "") {
      echo $filepath;