Jump to content

Show files from different pages


Recommended Posts


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


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


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 class="col-md-2">
		'. $item->filesizeStr .'<br />
		<div class="col-md-4">
		'. $item->description .'<br />
		<div class="row">
		<div class="col-md-12 lijn">
		<div class="lijn"></div>


Link to comment
Share on other sites


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

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...