Jump to content
tooth-paste

Show files from different pages

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

Share this post


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

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.

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