tooth-paste Posted September 14, 2018 Share Posted September 14, 2018 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 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>'; } Link to comment Share on other sites More sharing options...
clsource Posted September 14, 2018 Share Posted September 14, 2018 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; } } 3 1 Link to comment Share on other sites More sharing options...
tooth-paste Posted September 14, 2018 Author Share Posted September 14, 2018 Thank you! that did the trick! 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now