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>


Share this post

Link to post
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

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...