Jump to content

Search the Community

Showing results for tags 'children'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • 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


Last Updated

  • Start


Filter by number of...


  • Start





Website URL







  1. Hi all I've been using ProcessWire for a while and am completely comfortable using it. BUT, for some reason, today I am unable to echo out a page link! I have a section (About Us), which did have 4 children. Today I have added a 5th child page, but it refuses to be added to the navigation. I've echoed out the count of children and it is coming back as 4, even though there are now 5. The page is published and saves fine. I've deleted it and re-added it, to no avail. Has anyone else ever had this issue? Any suggestions more than welcome! Code for generating menu is below. $navigation = $page->rootParent->navigation; if(count($navigation) > 0) { //echo count($navigation); foreach($navigation as $p) { $children = $p->children; //echo $p->url; //echo count($children); // count children (exclude certain templates) if(count($children) && $p->is("template!=news-page|team-page|development-land-page|sheep-sales-page|produce-sales-page|grass-keep-page|property-list-page|property-auctions-page")) { // accordion header ?> <a href="#" class="submenu<?php if($page->parents->has($p) || $p === $page) echo '-current'; ?>"><?= $p->title; ?></a> <?php // expandable sub-menu ?> <div class="sub-sub-links <?php if($page->parents->has($p) || $p === $page) echo 'active'; ?>"> <?php foreach($children as $child) { ?> <a href="<?= $child->url; ?>" <?php if($child === $page) echo 'class="sub-sub-links-current"'; ?>><?= $child->title; ?></a> <?php } ?> </div> <?php } else { // single page if ($page->parents->has($p) || $p === $page) { $class = 'sub-links-current'; } else { $class = ''; } ?> <a href="<?= $p->url; ?>" class="<?= $class; ?>"><?= $p->title; ?></a> <?php } }
  2. Is there a way to have new children appear at the top of the list of children when they're first created (rather than at the bottom) whilst also allowing the user to do custom ordering? I seem to remember seeing this option somewhere but I can't find it. Perhaps I'm misremembering! Many thanks in advance!
  3. Hello, I think that an option inside templates that could limit the number of childrens that a page could have, maybe is useful in certains conditions. it´s that possible or I have to rely on hooks? thanks.
  4. For some reason this is not getting the content from the hidden child pages that I was hoping to see. $staff = $pages->get("/about-us/meet-the-team/, include=hidden")->children; ?> <div class="row firstrow lastrow"> <?php foreach($staff as $member){ echo $member->body; } As you can see, I am trying to publish hidden staff pages as content on a single page. Any clues as to what I am doing wrong?
  5. Sorry for that messy topic title but my problem seems very complicated to describe in so few words. So here a better description of my issue: I have a many product detail site under a parent called /overview/. On this product detail site is at the footer a listing of all the others product detail sites including the site itself. (all children of the parent /overview/. So i have for example: /overview/test1/ /overview/test2/ /overview/test3/ /overview/test4/ /overview/test5/ My Code look like this at the moment: <?php $overview = $pages->get("/overview/"); $overviewchildren = $overview->children("limit=4"); foreach($overviewchildren as $overviewchild) {?> <a href="<?=$overviewchild->url?>"><?=$overviewchild->title?></a> <?}?> Now on the site /overview/test1/ the code list show test1, test2, test3, test4. But i want that the child on which the user is at the moment dont show up at the list. So for the site /overview/test2/ the list should show test1, test3, test4 and test5. I hope you understand my problem , cause im from germany and to describe a php issue in english is very hard for me. Thanks a lot everybody for helping me.
  6. First the structure (offtopic, Structure reminds me of EE ) Home -Company Page --Section (template: container) ---Child page 1 (template: content) ---Child page 2 (template: content) ---etc. I have editors that can add pages to template container, but not edit the page. Problem is that they can not sort the child pages (template:content) by default. Solved it by adding a 'move-children' role that has move-pages and sort-pages permissions. The problem lies in setting that role and permissions to the template 'container'. You cannot select the 'Create Pages' checkbox for role 'move-children' unless you also give the 'move-children' role the 'edit-page' permission. (It's disabled) (I'm not sure if I'm using the correct terms...) Eventually I solved it by setting the 'edit-pages' permission to the 'move-children' role, checking all the boxes for the template access, and then removing the 'edit-pages' permission. I don't know if this is the intented behaviour but I thought I'd share it with you to see what you've experienced. Thanks
  7. Hi there, First of all, I am sorry for the spam of small questions, but as they are all very simple and fit for my problems, they can as well fit for someone else's problems too. I am testing around the $page->children function and I wanted to find all the children inside the children of the page's first child. It is a bit complicated to explain, but I'll illustrate the situation: first level - > second level - - - > third level - - - - - - > fourth level - - - > third level - - - - - - > fourth level - - - - - - > fourth level - - - > third level If we read this list as a page tree, I want to find the url of each "fourth level" page. I have tried the most logical yet with no success: <?php foreach( $page->child->children->children as $children) { ?> <h1><?php echo $children->url ?></h1> <?php } ?> What am I doing wrong? In JQuery terms I could navigate through my levels with the $(this).parents()[5] function, but Processwire seems to lack this capability. Thanks in advance
  8. Hello, I'm trying to write an if statement which queries whether a given page - identified by that page's title - has any children. I've tried various things, the most hopeful being: $info = $pages->find("title=previous caption winners")->children; if ( $info >= 1 ) { //do stuff }; but to no avail. This seems like a fairly simple task but I've had no success despite my efforts to find answers here and elsewhere. Any help would be greatly appreciated. All thanks, ben
  9. I am trying to output a list of link to children pages that display the child's title and the first image on the child page. I am doing that ok but I do not know how to return a thumbnail size image rather than full size. My image field is called "selectedimages". This is what I have: <?php if ($page->children) { foreach($page->children as $selectedthumbs) { $firstimage = $selectedthumbs->selectedimages->first(); echo "<a href='{$selectedthumbs->url}'><img src='{$firstimage->url}' alt='{$firstimage->description}'></a>"; }} ?>
  10. First of all: I love Processwire and feel a strong urge to migrate all my clients systems from MODx Still, I have a little problem just now: I need to add two direct children to my front page (the top of the tree, which is opened on page load). I want the front page to appear in my menu (Already did this with MarkupSimpleNavigation) and have two direct child pages. Is there any way to accomplish this? I thought about just using the top-element as an empty one and somehow mark another page, which can have as many children as I want, as the default front page.
  11. Is there a more efficient way to code this using children($selector)?: $ancestor = $pages->get( 1134 ); // Get the Section 1 page $find = $pages->find( "parent=$ancestor->children, template=subcategory" ); $assets = $pages->find( "tag=$find, sort=title" ); if ( count( $assets ) ) { foreach ( $assets as $asset ) { echo "<div class='asset'><a href='{$asset->url}'>{$asset->title}</a></div>"; } } The page hierarchy looks like this: - Browse (the page that this code resides on) -- Section 1 (the ancestor page with id of 1134) --- Category 1 ---- Subcategory 1 ---- Subcategory 2 --- Category 2 ---- Subcategory 3 ---- Subcategory 4 -- Section 2 --- Category 3 ---- Subcategory 5 ---- Subcategory 6 --- Category 4 ---- Subcategory 7 ---- Subcategory 8 - Assets -- Asset 1 (tag = id of Subcategory 1) -- Asset 2 (tag = id of Subcategory 2) -- Asset 3 (tag = id of Subcategory 3) -- Asset 4 (tag = id of Subcategory 4) I want to display all of the assets where tag = id of Subcategory 1, Subcategory 2, Subcategory 3, and Subcategory 4. In other words, I want to display all assets that are "included" in Section 1.
  • Create New...