Search the Community

Showing results for tags 'children'.

More search options

  • 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

Found 28 results

  1. Alright. So I'm converting a site I already have to Processwire (really enjoying it so far!). I wanted to convert the previous tables that I had data in to Processwire pages. But I'm wondering what the optimal way to structure pages would be. So basically, I have three main tables. Users (and all accompanying information) Items (and all accompanying information) Aquariums (each user only has 1 aquarium. Currently, user_id is a FK) Fish (type of item. Aquariums may have multiple fish) Aqua_settings (Things like lightness, temperature, etc) So in my current setup, there are a lot of Foreign Keys. I could accomplish essentially the same thing by using the Page Reference field. Alternatively, I could make fish and aqua_settings both be children of Aquarium. I could differentiate by doing $aquarium->children('template=aqua_settings'); or something. So my question is...should I be using the Page Reference field or structuring the pages as children? (Or are both equally fine depending on how I want to go about doing things)
  2. Hello, Pleased to meet you,my name is Csaba and I'm from Hungary. I've just installed processwire to more places. I created new parent and children pages. The children page links are not displayed on the right side of the parent pages. The sample About page is ok, Child page example 1 and Child page example 2 links are visible and live. But my child pages are not displayed on the parent pages. Please help!
  3. I wish to access a template's allowed templates for it's children from the API. This one: I am pretty sure this is possible, but I can't seem to find it anywhere in the documentation. If this is not possible, is there some way of assigning properties to templates? So like fields that already have a value on all pages using that template.
  4. Hey, I completely built this platform with ProcessWire ( It works fine except for the fact that some pages are still show, even when I change their state to "unpublished". They are still showing when they are returned through $object->children("template=_foo") or $pages->find("template=_foo"). Does anybody know what the problem might be?
  5. The Fotomediale is a annual festival of photography for children's and youth photography in Freiburg, Germany. This small website provides information about the festival and its workshops. Because of the topic, this site is very picture heavy. Almost every page contains it own set of images displayed in the background. The images cycle through automatically, but you can also use the buttons on the edges (or if you want arrow keys on your keyboard ). If you want to see the images, you can collapse both the navigation and content area. The transitions between pages were made with Ajax and pushState, but you can also access them directly via their URL. To handle the large image backgrounds, all of the images are lazy loaded using lazysizes. The registration form was created using the API. Modules used: ProCache Markup Sitemap XML Email Obfuscation (EMO) Tracy Debugger Regards, Andreas
  6. I just had a duh! moment and thought I should share as it may be useful to others, especially PW beginners. I know a lot of you will go "yeah well duh...." and yeah, well I feel like a bit of an idiot but anyways.... I had a page outputting a table detailing data from about 200 records (PW pages). For each record it searched for child pages of a certain template, probably averaging 3 child pages per record and added some data from those pages to each row of the table. Simple stuff. The page was averaging about 12 seconds to load. Anyway, today I got frustrated enough to try to work out why it was so slow. Turns out I realised that the child pages I was searching for were all direct children, so I changed my search method from $pages->get(....)->find(.....) to $pages->get(.....)->children(.....) and blow me down the page load has gone from 12 seconds to a tad over 1 second. Turns out each child page had many child pages of their own (thousand of pages in total) and all these were being searched with the find() method. Stupid mistake, but I think right from the beginning of my learning of PW the find() method was ingrained. So hopefully this helps some newbies and others like me. Check out and for more info on these methods and others.
  7. Hello Real Beginner here. I am trying to loop the children of a product ( Keramik ) I have. They should look as an image with text underneath ( Example with bicycle tires ). I create for each product an own child page . I can't get my head around this... Thanks for all the help. Jakob I would like to have 3 Images with text on each row My structure: Each child has a Title, img and description
  8. I have a PageTable field (editions) that I need to access the top page even if the page is unpublished: $page->editions[0]->id This throws up an error when the top page is unpublished, however works fine when it's published. I know I can't access the pages as children because the PageTable order differs from the child order, and I need the top page as it is in the PageTable field. Any ideas how I may be able to do this?
  9. I am currently working on a site that lists about two hundred product series, which are displayed to the visitor as a web page. Beneath each of these Series pages are one or more children, and they may be nearly identical, with a few key differences. Does anyone have any advice on how I might run through the 'foreach' of the children on the Series' output page, and determine if the field values are the same or unique, and output the unique values while "merging" the common values? For example: Product Series A contains: Model A - which has a "color" field value of "blue" Model B - which has a "color" field value of "blue" Model C - which has a "color" field value of "green" Model D - which has a "color" field value of "red" So in this example, I'd want to list this information as: Product Series A [[bunches of info from the Series parent page's fields]] Specifications Color: Blue (Models A and B), Green (Model C), or red (Model D) Or, if the values were all the same, it would list just the value without the model mentions. Thanks in advance, even if you just have a direction to point me in, I'd appreciate any input. My brain is fried from all the crazy logic I've had to implement for this site already.
  10. I am not sure whether this has been asked before. I tried googling, but got slightly different topics, so I post this as a new topic now. Sorry. I have a «protected» page. The guest user is not allowed to view this page, only a few roles. Now the customer want this page to appear in the navigation even for guest users. When they click on the item they should be presented with the Processwire login then they should be able to view the protected page. This works if I give them the direct link, and if they are logged in, the protected page also appears in the navigation. This is the code for the navigation. It's a two-level navigation. Sorry about the alternative syntax. I know it's controversial, but I like it for templating. <? foreach (top_pages() as $top): ?> <li id="nav_<?=$top->id?>" class="top"> <a href="<?=$top->url?>"><?=$top->title?></a> <? if ($top->numChildren): ?> <ul> <? foreach ($top->children as $child): ?> <li class="sub"><a href="<?=$child->url?>"><?=$child->title?></a></li> <? endforeach ?> </ul> <? endif ?> </li> <? endforeach ?> Now, how can I get the children of $top as a given role even when not logged in?
  11. So, here I am, working at the weekend again to get this site done. I'm hoping someone can help me get over this hurdle. I'll try to explain it as best as I can. I have notes pages using a template 'note'. Children of those pages are comments, using a template 'comment'. When a comment is posted, their username is recorded in the field comment_username attached to the comment template. There is one particularly important commenter. Let's call him John. What I need to do is select new comments where at least one of the comments before that was from John. I'm trying all kinds of crazy $pages->find things, but going around in circles!
  12. I have started to use PW 3 in my latest project and it's working out really great (as expected). I have one issue though which I can't figure out. I am developing an order system, where users can log in, select a product, make some configurations to it and then order the product. The orders are saved as child pages to each user. So far, no problem. What I am trying to achieve is to put the orders in a subpage of the user called "orders", for better clarity in the users' structure. So i create a subpage "orders" with the first order of a user, and save the order as a child of this. - user - - orders - - - order1 - - - order2 - - - order3 The problem occurs when the user submits more orders: I can't get the "orders" subpage to put the new order inside it, so an additional "orders" subpage is created with each new order. - user - - orders - - - order1 - - orders - - - order2 - - orders - - - order3 This is my approach: // get the first child of the user page with the template "orders" // apparently this does not work as I expected and always returns a NullPage $parent = $user->child("template=orders"); // if "orders" subpage is a NullPage, create new page if ($parent instanceof NullPage) { $orderContainer = new Page(); $orderContainer->parent = $user; $orderContainer->template = "orders"; $orderContainer->title = "Orders"; $orderContainer->save(); $parent = $orderContainer; } $order = new Page(); $order->template = "product-configure"; $order->title = "Order: " . $order_name; $order->parent = $parent; $order->country = $country; $order->publication = $publication; $order->comments = $comments; $order->save(); Any hints are appreciated...
  13. Hi, We encountered a strange problem regarding the selector behaviour in find()/children(). Background information: Our page setup regarding the templates/fields that go wrong is as follows: Please note that both faq-category and faq-detail are hidden pages, due to the fact that we only wish to display them on faq-overview, not any where else. What's happening: We are using the following selectors to load the faq-categories and within the faq-detail pages. $page->children->find("template=faq-category, include=hidden") Then, for each child of that result, we use the following code: $questionCat->children->find("template=faq-detail, include=hidden") Results from both selector queries are 0 results. If we only use template=faq-category, 14 results (of the 18 pages, a few are unpublished, a few are hidden). If we use the code above, or any variation on it, zero results. None of these work: $page->children->find("template=faq-category, include=hidden") $page->children->find("template=faq-category, include=all") $page->children->find("template=faq-category, status=hidden|published") And now for the strangest part (because I could've just done it wrong, couldn't I): The following code dóes work and returns 16 results (the 14 published ones, 2 hidden ones, and the 2 unpublished ones aren't included, as should be): $pages->find("template=faq-category, status=hidden|published, parent=" . $page->id) $pages->find("template=faq-detail, status=hidden|published, parent=" . $questionCat->id) If anyone is able to give us any insight as of why this is happening and whether it's because we made a mistake (or it's a bug in ProcessWire? Can't imagine but... you never know), that would be great!
  14. Hello! I'm just starting off. Is it possible to have a somewhat dynamic edit area for a page? I would like the area to have fields that correspond to the children of the page. Each field is the same, but the number of them is the number of children. For example, these pages: ---Resources ------Bob ------Bill ------Joe ------Kevin Then, on the edit screen for "Resources," there would be a section for each person. If I deleted a child page, person, then the section would get deleted. Is this possible with PW? Or should I rethink my approach? Thanks!
  15. I have a that outputs children pages by the id number. The id number is from a pagefield id representing the event. I would like to replace with this information from the child page: $page->event->last()->title; my has this code: if($page->numChildren) { echo "<ul class='nav'>"; foreach($page->children as $child) { echo "<li><p><a href='{$child->url}'>{$child->event->last()->title}</a><br /> <span class='summary'>{$child->summary}</span></p></li>"; } echo "</ul>"; } Edit: SOLVED! I am an idiot. Code was at the bottom of my template page not my
  16. I am looking to display Scorecards on a rider_profile.php page. I am using a event_results.php page that has a pagetable field that generated the scorecards. The settings of the pagetable field has the pages being created under a page called scorecards. There are going to be multiple cards throughout the year for each rider depending on how many events they attend. Since there are multiple cards per rider I set the pagetable setting for Automatic Page Name Format to Ymd:His to create different folders for each scorecard. When I did that my code below doesn't work of course. How do I search the children folders? I am using $pages so I don't think I can use children() . $event_hx = $pages->get("/2014-season/scorecards/")->find("template=scorecard, Competitor~=$rider"); foreach($event_hx as $hx) echo "<li><a href='{$hx->url}'>{$hx->Event_Name}</a></li>"; Link to Dr Frankenstein's monster. EDIT: I noticed this thread suggested by the forum as related and changed the code to below and it works. $pages->get("/2014-season/scorecards/, include=all")
  17. Hey, i'm just started with Processwire, followed the tutorials and every basic thing i try seems to work, better than i expected. I already love Processwire and it's many possibilities. But now i have a very complicated (althrough for a beginner) situation. I want to get te children of a page (exist only out an image and title) and under the title and image of the children the titles and urls of the children of these children: Page Child 1 - Title - Image Child 1 of Child 1 - Title -Url Child 2 of Child 1 - Title -Url Child 3 of Child 1 - Title -Url Child 2 - Title - Image Child 1 of Child 2 - Title -Url Child 2 of Child 2 - Title -Url Child 3 of Child 2 - Title -Url Child 3 - Title - Image Child 1 of Child 3 - Title -Url I tried many diffrent ways, but it does not work at all! (i just get nothing on the page) Its getting to difficult for me as a beginner, i ended up with the following code: <?php $pagename = $page->child->title; foreach($page->children as $headimage) { $thumb = $headimage->size(600, 400); $pagename = $page->child->title; echo "<div class='section'>"; echo "<a href='$page->child->url'>"; echo "<div class='sectionimage'>"; echo "<div class='image'>"; echo "<img src='$thumb->url' alt='$headimage->description'></img>"; echo "</div>"; echo "<div class='caption'>"; echo "<p>'$page->$child->title'</p>"; echo "</div>"; echo "</div>"; echo "</a"; echo "<div class='brands'>"; echo "<ul>"; foreach($page->children->children as $childchild) { echo "<li><a href='$childchild->url'>'$childchild->title'</a></li>"; } echo "</ul>"; echo "</div>"; echo "</div>"; } ?> what am i doing wrong ? thanks.
  18. 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 } }
  19. 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!
  20. 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.
  21. 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?
  22. 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.
  23. 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
  24. 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
  25. 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