Jump to content

Search the Community

Showing results for tags 'grandchild'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 1 result

  1. I have a new challenge - outputting the grandchild pages of 3 children (simple enough) but confine the display of each grandchild under it's parent heading. Will try explain... My tree looks like this: Foods (where I want to mirror the structure below in a table) - Fruit (Child of Foods and Level 2 Parent) - - Apple - - Banana - - Orange - Vegetable (Child of Foods and Level 2 Parent) - - Carrot - - Potato - - Cauliflower - Meats (Child of Foods and Level 2 Parent) - - Beef - - Pork - - Chicken Lets say "Foods" is the parent. Fruit, Veg and Meat are children. Apple, Bananna etc are grand children I have the Foods template working to an extent but it's doing the following. IE it's Fruit - - Apple - - Banana - - Orange - - Carrot - - Potato - - Cauliflower - - Beef - - Pork - - Chicken Vegetable - - Apple - - Bananna - - Orange - - Carrot - - Potato - - Cauliflower - - Beef - - Pork - - Chicken Meats - - Apple - - Bananna - - Orange - - Carrot - - Potato - - Cauliflower - - Beef - - Pork - - Chicken This is my effort so far. <?php // the children of this page $products = $page->children(); foreach ($products as $prod){ // Create a table for each child page echo" <div> <div class='prod-ov-wrapper'> <div class='prod-ov-text'> {$prod->title} <table class='uk-table uk-table-divider' border=1> <thead> <tr> <th>Part No.</th> <th>Length</th> <th>Break Force</th> <th>Width</th> <th>Colour</th> </tr> </thead> <tbody> "; // populate the table with details of the children of each child $proditem = $page->find("parent=$page->children, template=product"); foreach ($proditem as $prodDetail){ echo" <tr> <td>{$prodDetail->prod_partNo}</td> <td>{$prodDetail->prod_length}</td> <td>{$prodDetail->prod_breakForce}</td> <td>{$prodDetail->prod_width}</td> <td>{$prodDetail->title}</td> </tr> ";} echo" </tbody> </table> </div> </div> </div> ";} ?> I've tried a couple of things over the last few hours and just can't quite understand the API call I need at $proditem = $page->find("parent=$page->children, template=product"); foreach ($proditem as $prodDetail){ echo" is there a way to do this? I suspect I am close but need to add another variable in there?
×
×
  • Create New...