0

I'm running into a problem with Assets & Structure Entries 1.3.4 & 1.2.8 — effectively it boils down to the fact that my Assets field only returns the filename, not the entire folder path.

Here's a couple of examples:

{exp:channel:entries channel="staff"}
  {staff_photo} - returns /ee-uploads/images/staff/filename.jpg
{/exp:channel:entries}

That works as expected, however if I need to do this within Structure Entries:

{exp:structure_entries depth="1" parent="9"}
  {staff_photo} - returns filename.jpg but not the full path
  {staff_photo:url} - returns nothing just the tag
{/exp:structure_entries}

I've also tried adding parse inward to this tag:

{exp:structure_entries depth="1" parent="9" parse="inward"}
  {staff_photo} - returns filename.jpg but not the full path
  {staff_photo:url} - returns nothing just the tag
{/exp:structure_entries}

However I get the exact same result with or without parse="inward". Does anyone have any ideas I'm really stuck here. It's worth noting that this problem doesn't arise when using the build in Structure tag of exp:structure:entries but I need access to the {current_page} variable available within the Structure Entries plugin as well as a couple of other features. Any help would be really appreciated at this point.

ExpressionEngine: 2.6.1 / Assets: 2.1.3 / Structure 3.3.10 / Structure Entries 1.3.4

Thanks!

EDIT: It's worth noting that when I add the parse inward tag I do get this error:

  Severity: Notice

  Message: Undefined property: Assets_ft::$row

  Filename: assets/ft.assets.php

  Line Number: 1094
2
  • Hey Ben, Could you ping us at [email protected], preferrably with CP access (FTP as well would be perfect) so we can look into this for you? Commented Jun 13, 2013 at 6:19
  • This isn't a problem with Assets, but the way that structure_entries parses third-party fieldtypes. Commented Jun 13, 2013 at 8:13

3 Answers 3

1

the issue is that Structure Entries doesn't parse the newer variable references (e.g. {staff_photo:url}) and it only parses EE file paths:

$this->EE->typography->parse_file_paths($output);

Alas the add-on is very old and tries to manually parse each row and each fieldtype it supports (only aimed at supporting Playa and Matrix originally).

Apologies for this suggestion as this is a fudge fix, but try

{exp:structure_entries depth="1" parent="9"}
  {exp:assets:files filename="{staff_photo}"}{url_huge}{/exp:assets:files}
{/exp:structure_entries}

Ref: http://docs.pixelandtonic.com/assets/templating/module/files.html

Failing that: https://github.com/rsanchez/parse_file_paths

1
  • Thanks for the suggestion, unfortunately using the exp:assests:files loop method doesn't work. Will have a look at my other options before trying the Parse File Paths.
    – Ben
    Commented Jun 13, 2013 at 23:56
1

I have added an updated version of parse_file_paths by rsanchez as a fork which now will work in EE 3.x and up.

All I did was to add the addon.setup.php file to the zip file with the appropriate fields filled in. The original code still works like a champ!

This works very well with the Query module. It takes the raw results containing {filedir_X} and expands that into the actual file path, using a routine already in the typography.php library in EE but for some reason that is not used by the query module by default. This little addon makes up for that.

1
  • You can now see the new "parse_file_paths" in action by performing a search on this page ncwildflower.org/plant_galleries/all_fields_search -- the results page loads the thumbnails on the left in a loop driven by the query module getting the image paths from that plugin. (in EE 5.2.1 as of this writing) Commented Mar 14, 2019 at 23:54
0

In case anyone else is still stuck on this, I was able to solve this using Peter's solution, with a slight variation on the assets:files syntax:

{exp:structure_entries depth="1" parent="9"}
  {exp:assets:files folder="*" keywords="{staff_photo}" recursive="yes"}
    {url}
  {/exp:assets:files}
{/exp:structure_entries}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.