Jump to content

Search the Community

Showing results for tags 'children'.

  • 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

  1. Hi all, I use version 3.0.62. Is there a way to delete all children of a page with one click - without parent page? thanks
  2. 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
  3. So I reread my first draft, and it made absolutely no sense (I deleted it to hopefully better explain myself). I am trying to make a system (that to me is a bit complicated) utilizing jquery and processwire together. My whole goal is to put a url like https://domain.com/launch?first_name=jim&occupation=builder in a script tag on another site(just a localhost .php page) to then pull out the data for that person and append to divs etc. Basically, the initial script tag would point to "launch" which has a content-type of "application/javascript". Using jquery, I would pull out the persons name and occupation and then make a specific ajax get request to "domain.com/api" (in json format) for a look up of the person. Essentially then I could pull that particular person's information from the json data, and do with it how I please in the "launch" page. In processwire, I have a page structure like: People -Jim Bob (template: person ) --Occupations (template: basic-page) ---Builder (template: occupation) ---Greeter (template: occupation) It is really just a bunch of people with their occupations and a few fields to the occupation template. With the "api" (template: api) url, I was hoping to return all the data (of people) in json format like: Example Format: { "id": 1, "title": "Jim Bob", "occupations": { "builder": { "id": 44, "title": "Builder", "years_worked": 1, "etc": "ect", }, "Greeter": { "id": 44, "title": "Greeter", "years_worked": 1, "etc": "ect", }, } } Where I get lost is really outputting the page names and nesting in the occupations into json. I have used Pages2JSON before, but I was a bit lost on how to implement what i was thinking. I have access to all the local host files, but I was hoping to kind of build out a "system" where I could place the script tag/parameters in any project, and be able to interact with the data without doing an ajax call on the actual site. In a way, this would keep processwire handling all the data and requests, and my other "projects" just with a simple script tag. This might all be way too much/over complicated, but I couldn't quite wrap my head around how to achieve it.
  4. 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...
  5. Hello PW Community, really glad that discovered this CMS recently, it is very strange it took so long That idea of no front design limitations is just awesome! Need to say that I have a bit of knowledge of html and css, but almost no php, so I need your help. What I want to do is an article posting cms, with this structure: - Homepage - Projects - Articles -- Category 1 --- Articles of category 1 -- Category 2 --- Articles of category 2 - About - Contact Found this ProcessWire Profile https://github.com/tutsplus/how-to-create-an-ajax-driven-theme-for-processwire It covers almost all my needs, except the menu. When I add a childpage for this page http://artist.nicegrp.com/publications/world-world/ , World:World doesn't appear under Writings & Publications. I need a menu that works like a breadcrumb, that shows on the menu the category that you are viewing. So when I'm in articles page, on the menu it shows only articles and it's categories. When I get into a category, that category takes state active link but doesn't show on the menu links and titles for contained articles. How can I do that? Sorry for my long writing and English, it is not my native but I hope you understood what I need. Can you help me with that? Thank you
  6. AndZyk

    Fotomediale

    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. www.fotomediale.de Modules used: ProCache Markup Sitemap XML Email Obfuscation (EMO) Tracy Debugger Regards, Andreas
  7. SYNOPSIS A little guide to generating an sitemap.xml using (I believe) a script Ryan originally wrote with the addition of being able to optionally exclude child pages from being output in the sitemap.xml file. I was looking back on a small project today where I was using a php script to generate an xml file, I believe the original was written by Ryan. Anyway, I needed a quick fix for the script to allow me to optionally exclude children of pages from being included in the sitemap.xml output. OVERVIEW A good example of this is a site where if you visit /minutes/ a page displays a list of board meetings which includes a title, date, description and link to download the .pdf file. I have a template called minutes and a template called minutes-document. The first page, minutes, when loaded via /minutes/ simply grabs all of its child pages and outputs the name, description and actual path of an uploaded .pdf file for a visitor to download. In my back-end I have the template MINUTES and MINUTES-DOCUMENT. Thus: So, basically, their employee can login, hover over minutes, click new, then create a new (child) record and name it the date of the meeting e.g. June 3rd, 2016 : --------------------------- OPTIONALLY EXCLUDING CHILDREN - SETUP Outputting the sitemap.xml and optionally excluding children that belong to a template. The setup of the original script is as follows: 1. Save the file to the templates folder as sitemap.xml.php 2. Create a template called sitemap-xml and use the sitemap.xml.php file. 3. Create a page called sitemap.xml using the sitemap-xml template Now, with that done you will need to make only a couple of slight modifications that will allow the script to exclude children of a template from output to the sitemap.xml 1. Create a new checkbox field and name it: sitemap_exclude_children 2. Add the field to a template that you want to control whether the children are included/excluded from the sitemap. In my example I added it to my "minutes" template. 3. Next, go to a page that uses a template with the field you added above. In my case, "MINUTES" 4. Enable the checkbox to exclude children, leave it unchecked to include children. For example, in my MINUTES page I enabled the checkbox and now when /sitemap.xml is loaded the children for the MINUTES do not appear in the file. A SIMPLE CONDITIONAL TO CHECK THE "sitemap_exclude_children" VALUE This was a pretty easy modification to an existing script, adding only one line. I just figure there may be others out there using this script with the same needs. I simply inserted the if condition as the first line in the function: function renderSitemapChildren(Page $page) { if($page->sitemap_exclude_children) return ""; ... ... ... THE FULL SCRIPT WITH MODIFICATION <?php /** * ProcessWire Template to power a sitemap.xml * * 1. Copy this file to /site/templates/sitemap-xml.php * 2. Add the new template from the admin. * Under the "URLs" section, set it to NOT use trailing slashes. * 3. Create a new page at the root level, use your sitemap-xml template * and name the page "sitemap.xml". * * Note: hidden pages (and their children) are excluded from the sitemap. * If you have hidden pages that you want to be included, you can do so * by specifying the ID or path to them in an array sent to the * renderSiteMapXML() method at the bottom of this file. For instance: * * echo renderSiteMapXML(array('/hidden/page/', '/another/hidden/page/')); * * patch to prevent pages from including children in the sitemap when a field is checked / johnwarrenllc.com * 1. create a checkbox field named sitemap_exclude_children * 2. add the field to the parent template(s) you plan to use * 3. when a new page is create with this template, checking the field will prevent its children from being included in the sitemap.xml output */ function renderSitemapPage(Page $page) { return "\n<url>" . "\n\t<loc>" . $page->httpUrl . "</loc>" . "\n\t<lastmod>" . date("Y-m-d", $page->modified) . "</lastmod>" . "\n</url>"; } function renderSitemapChildren(Page $page) { if($page->sitemap_exclude_children) return ""; /* Aded to exclude CHILDREN if field is checked */ $out = ''; $newParents = new PageArray(); $children = $page->children; foreach($children as $child) { $out .= renderSitemapPage($child); if($child->numChildren) $newParents->add($child); else wire('pages')->uncache($child); } foreach($newParents as $newParent) { $out .= renderSitemapChildren($newParent); wire('pages')->uncache($newParent); } return $out; } function renderSitemapXML(array $paths = array()) { $out = '<?xml version="1.0" encoding="UTF-8"?>' . "\n" . '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'; array_unshift($paths, '/'); // prepend homepage foreach($paths as $path) { $page = wire('pages')->get($path); if(!$page->id) continue; $out .= renderSitemapPage($page); if($page->numChildren) { $out .= renderSitemapChildren($page); } } $out .= "\n</urlset>"; return $out; } header("Content-Type: text/xml"); echo renderSitemapXML(); // Example: echo renderSitemapXML(array('/hidden/page/')); In conclusion, I have used a couple different processwire sitemap generating modules. But for my needs, the above script is fast and easy to setup/modify. - Thanks
  8. How do I change the permissions for Who can access this page for a single page. This page inherits the admin template. I'm currently creating a new page called Settings using admin template and assigning it to a process of a module. I can see the Settings tab in superuser, but I can't see them in a role I defined called 'client'. So, how can i control what the client sees for admin template? Is there a page specific overwrites for permissions. I've tried allowing access in admin template view, edit. But still doesn't work
  9. 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)
  10. 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.
  11. 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!
  12. 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.
  13. 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?
  14. Hey, I completely built this platform with ProcessWire (http://djmag.live/). 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?
  15. 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 http://cheatsheet.processwire.com/page/built-in-methods-reference/page-find-selector/ and http://cheatsheet.processwire.com/page/built-in-methods-reference/page-children-selector/ for more info on these methods and others.
  16. 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
  17. 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?
  18. 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?
  19. 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!
  20. Hi I have a question about the "Name format for children" option for Templates. This option only shows up when i allow 1 single template under the "allowed templates" option. The Scenario: I have a template called "activity", the activity template can have or it is allowed only to have 4 template types as children: date, cast, image and video. My Problem is that i want that only the page name of the date pages are genereated automatically with the "Name format for children". But this option is only working when i allow only 1 template as children. How can I achieve, that the "Name format for children" works also when its allowed more than 1 children. Here is the Tree structure for visualization:
  21. 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!
  22. Hey there guys, Current situation: The page structure looks like this: Home ->About ->->Page 1 ->->Page 2 ->Test This structure comes back in the navbar menu. I'm using bootstrap as css/js framework. "About" is the visible container for the dropdown menu of Page 1 and Page 2. I click on About and then I see Page 1 and Page 2 which is great. What I would like to have is this: Home ->About ->Page 1 ->Page 2 ->Test and still have "About" as the visible container for Page 1 and Page 2 in the navbar so it acts like it's parent (without being an actual parent). Is there any way in processwire to have such parent page without an actual page? To get the bootstrap navbar working with the processwire page structure I was following this tutorial http://wiki.processwire.com/index.php/Bootstrap_Navbar
  23. 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!
  24. I have a events_footer.inc 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 events_footer.inc 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 footer.inc.
  25. 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")
×
×
  • Create New...