Jump to content

Invalid arguments supplied for foreach


Marvin
 Share

Recommended Posts

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

 

 

Link to comment
Share on other sites

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

  }
}

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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
 Share

×
×
  • Create New...