Jump to content

Recommended Posts

Posted

Hello, i want to ask, i maintain a website that using a processwire and php, and i want to make an archive at my website using a subfolder system, but when i try,
the sebfolder is show but when i click the files in that subfolder not show, and my browser just show me an error Invalid argument supplied for foreach(), i don't know why it error

Here i attach my code and my screenshoot website :

This is my code

code.thumb.png.51207362b3f9ca7ac7f4b058d86fca46.png

This is result of my website

code1.png.19f0eb5cb7078b9321e963b25007d026.png

This is my error

code2.png.e12681bf8fcfd15c881ddc22140e7709.png

 

 

Posted

The first selector looks a bit strange to me.

It says: "get the children of the page at path /files/ where its title is the same as the current page I'm on"...mmm.

Could you elaborate a bit more? ?

Posted

Oh sorry, i attach wrong code,

this is my code where the result is error,

code.thumb.png.093517b4ac25f7444dedf3a14c5fda52.png

 

Oh and sorry if i didn't understand what do you mean, because my english not good as well. Thanks

Posted

I think your selector should be:

foreach($pages->get("/files/")->children as $folder) {

// code for the first iteration, you are now inside the folder

  foreach($folder->files as $lagu) {

  // here you are iterating on the files

  }
}

 

Posted

I previously omitted some of your code for the sake of brevity, so yes, you can do whatever you want inside each foreach iteration.

Posted

I have been try your sugestion but it doesn't work either, because i have page in another page, when i try your sugest, the page didn;t show, but file is show, what i'm trying to make is a subfolder system. Thanks

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...