We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

File Grid (5.3.2) – file metadata variables don't work?

Development and Programming

directordash's avatar
directordash
3 posts
4 years ago
directordash's avatar directordash

Figured this would be the most useful part of file grid from a front-end dev POV…

But this:

{grid_field}
  {grid_field:file}
    {extension}
  {/grid_field:file}
{/grid_field}

Results in the file path being printed, followed by the extension. In other words, the file metadata tag pair that ordinary Grid has, doesn’t work here. Tried without the tag pair, and the extension (and any other file-field variable) doesn’t parse.

Anyone got any workarounds that don’t involve changing the whole thing back to an ordinary Grid field?

       
Robin Sowell's avatar
Robin Sowell
13,158 posts
4 years ago
Robin Sowell's avatar Robin Sowell

You shouldn’t need to work around- I just tested on the latest and it worked as expected. My file grid field is named afg (I can’t recall why). My test looked like:

{exp:channel:entries entry_id="18"}
<h3>{title}</h3>
{afg}
  {afg:file}
  {url} - {extension}

  {/afg:file}
{/afg}

{/exp:channel:entries}

Output was

ok, two cats!
<img src="https://e531:8890/themes/user/site/default/asset/img/blog/bad_fur_day.jpg" alt=""  /> - jpg
<img src="https://e531:8890/themes/user/site/default/asset/img/blog/avatar_tree_hugger_color.png" alt=""  /> - png

That said- your template code looks good to me, assuming ‘grid_field’ is the name of your grid field.

If that’s correct, I’d start with a simple test, similar to mine. And triple check the names. Still no lucky, try disabling extensions for a quick test.

But it should work. Basically code it like you would a file field in a grid, just making sure to use ‘file’ as the shortname of the file column. Though again- your basic code looks good from here.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.