Jump to content

Show files from different pages


tooth-paste
 Share

Recommended Posts

Hi,

I want to show 'All documents' from different pages. My tree is like this:

-Documents

--Docs A (template=portal-files, field=portal_bestanden)

--Docs B (template=portal-files, field=portal_bestanden)

--Docs C (template=portal-files, field=portal_bestanden)

 

On every page (Docs A for instance), different files are uploaded

888431410_Schermafbeelding2018-09-14om11_07_16.png.b3baf6bb30f36b1e3299f82820f90b21.png

This is my code. The output are only the files from the first page.

$items = $pages->get("template=portal-files")->portal_bestanden;
foreach ($items as $item) {
	$name = str_replace("_", " ", $item->name);
							
		echo '<div class="row" style="padding:7px 0 5px 0">
		<div class="col-md-6">
		<a href="'. $item->url .'">'. $name .'</a><br />
		</div>
		<div class="col-md-2">
		'. $item->filesizeStr .'<br />
		</div>
		<div class="col-md-4">
		'. $item->description .'<br />
		</div>
		</div>
		<div class="row">
		<div class="col-md-12 lijn">
		<div class="lijn"></div>
		</div>
		</div>';
												
	}

155401347_Schermafbeelding2018-09-14om11_40_55.png.ef63f8e36af4a3cd400d072564ee111e.png

Link to comment
Share on other sites

Hello,

this line would only get one item.

$items = $pages->get("template=portal-files")->portal_bestanden;

may be with this would work

$items = $pages->find("template=portal-files");

foreach($items as $item){
  foreach($item->portal_bestanden as $document){
       echo $document->name;
  }
}

 

  • Like 3
  • Thanks 1
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...