Jump to content

Recommended Posts

Posted

Hello fellow Process wire Developers!

Today i have encountered an issue using the repeater where I can't find out how to solve it therefore i am asking for help.

To be specific, I am trying to get the "file" field working properly in the repeater but i couldn't find a way on how to assign a property of a field that is being used by the repeater.

download_pdf is the name of the field that i want to access properties from.

What i wished i could do was something like $download->download_pdf.size or $download->download_pdf->name, something like that but obviously these didn't work :-)

Hope there is a solution and thanks in advance!

Best wishes,

Livius

Properties.png

Posted

Unless your files field is set to have a max of 1 file, then it's an array and you need first():

$download->download_pdf->first()->url;

 

  • Like 1
Posted

Hello!

For some reason this error did not show up as i was trying to do a simple echo of all this!

Using this with echo works and i will find a way to use it in the href too.

(Apart from the semicolon that i left up on the screenshot :P)

Thank you very much!

Posted
1 hour ago, Livius said:

i will find a way to use it in the href too

Try wrapping in curly braces:

<a href='{$download->download_pdf->first()->url}'>

 

  • Like 3
  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...