Jump to content

kongondo

PW-Moderators
  • Posts

    7,480
  • Joined

  • Last visited

  • Days Won

    146

Everything posted by kongondo

  1. @Soma, Should something like this not work? $slides = $pages->find("slides.disable_slide=0");// slides = repeater Currently not working for me...(returning incorrect results) Sorry, ignore: works fine... . It finds all pages with the repeater "slides" whose repeater fileds "disable_slide" are not checked.
  2. Duh! Of course, rookie mistake! Thanks Nik! I can't believe I missed that! (facepalm) Edited post above...
  3. OK, did some more tests with the checkbox as part of the repeater... slide = the repeater disabler = a checkbox inside the repeater foreach ($page->slide as $show) { if ($show->disabler!==1) { //edited to == echo "<li>$show->title</li>"; } else { echo "<li>I am hidden!</li>"; } } //!==1 works; !==0 works; ==0 works; ==1 works Edit: I had used assignment (=) operator rather than comparison (==)operator. See correction in post below by Nik
  4. Re-reading your post...I'm not sure I got your correctly... Are the checkboxes within the repeater field or are they an independent field on a page that has several repeaters? i.e., do you want to disable the page (including all its repeaters) or do you want to disable individual repeaters on a page? (e.g. show repeater instance 1, 3 and 4 of page x but disable repeater instance 2 and 5 of page x).
  5. This works for me just fine as follows: $test = $pages->find("template=basic-page, disabler=0") //$test is just a variable I create; disable is the name of the checkbox; basic-page is the template that has pages that have repeaters. I then traverse the repeaters... As for tips...repeaters are just pages under the page Admin. The repeater field itself (e.g. slides) is a page (whose parent is called "Repeaters") and the repeater instances on each page are its grandchild pages . The repeater's children are pages which have the repeaters. But you probably knew this already Repeaters slides (the repeater field itself) page 1 with repeater repeater instance 1 repeater instance 2 page 2 with repeater repeater instance 1 repeater instance 2 repeater instance 3
  6. creativejay, Welcome to PW! Just to make sure we understand what you are after...Is the following your situation? Example Tree gallery (parent page) Album A (child with 100 images) Album B (50 images) Album C (75 images) You want to grab a total of 30 images from Albums A - C and display them on the page gallery? Do you want to grab random images? I know you want to sort them by the latest (i.e. sort=-date). Do you want to grab the same number of images from each album? i.e. 10 each? I'm just trying to wrap my head round what you want to accomplish. Ryan's code above was for a situation where all the images were on one page (i.e. no child pages).
  7. Sorry, am rushing somewhere...the following will answer your question http://processwire.com/talk/topic/2786-request-seems-to-be-forged/ http://processwire.com/talk/topic/1563-this-request-was-aborted-because-it-appears-to-be-forged/ http://processwire.com/talk/topic/2102-using-previous-pw-installation-as-template-for-the-next-one/ http://processwire.com/talk/topic/2763-500-error-when-visiting-the-backend/ http://processwire.com/talk/topic/3668-internal-server-error-in-admin-page/
  8. You don't get anything because the pages are hidden. Add this to your selector include=hidden Please read this page: http://processwire.com/api/selectors/ and specifically this section in relation to access control in selectors.
  9. Hi Valery, See this page about using the API to add or remove repeater items There is a sample code on that page. As you can see, it can really be more simple compared to your code
  10. $pages->find() will find things; lots of things in some cases (pages) . You need to echo out the ouput. Do you get any errors? Is there really a template called "category"? Does it have any unpublished and hidden pages using it? In addition, have you read these documentation? http://processwire.com/api/selectors/ http://processwire.com/api/variables/page/ http://processwire.com/api/variables/pages/ By the way, normally, you don't want to do something like $pages->find() without including a "limit"; It can find lots of things...and eat into your server resources, maybe hang your pages, hence, frustrate your web visitors, etc... Edit: corrected typos
  11. I like this one too! Pity I can't wear both; maybe alternate every other week, hehe
  12. .... Yeah, where you place the $total = 0; determines whether you get cumulative totals, sub-totals or grand total
  13. Galaxy, See Diogo's code above. That should work for you. My problem was that I suggested code "independent" of your "result foreach" (I was starting with the $dollars = blah blah), which you don't need if you use your "result foreach" as Diogo suggests.. .....I'll eat my hat if Diogo's code doesn't work...I'm sure it will!
  14. OK, are those totals correct? E.g., is the total for YMCA = 2000?
  15. Galaxy, You haven't answered my questions above Have you tried to move the "grants foreach" outside the "result foreach" as I suggested above? Have you tried independently running the "grants foreach" as I suggested, in order to test the code?. It works for me here. At the moment, do not worry about the <li>s. The most important thing is to get the totals right, I think...
  16. That's why I suggested to move the grants foreach outside the result foreach. I don't see its use inside the very first (result foreach) ...I could be wrong though
  17. Why reinvent the wheel? Of course you can do that. I just prefer using phpMyAdmin for this
  18. @Diogo, That's what I initially thought he wanted; see my previous code on page 1 of this thread. He does not want the GRAND total across the site. He wants sub-totals, so to speak, e.g. Acorn $599 (total for this recipient from various sources [sum from several repeater fields on the Acorn page]) Evans Road church: $500 ([ditto]) In other words, he wants the totals for each recipient (which of course, add up to the GRAND total)
  19. Well, that's not what I am seeing on my tests . 1. What do you get when you ONLY run the grants total code, i.e. removing all other code but that one? 2. Try placing the grants foreach outside the result foreach like so: echo "<ul class='nav'>"; foreach($result as $child) { echo "<li>";//wrong? echo "<a href='{$child->url}' class='list-title'>{$child->title}</a>"; $image = $child->logo; if (count($child->logo)){ echo "<span style='padding-right:140px;'><a href='{$child->logo->url}'><img src='/site/assets/uploads/yes.png'></a></span>"; } else{ echo "<span style='padding-right:140px;'><img src='/site/assets/uploads/no.png'></span>"; } } //grants = name of repeater; grants = name of an integer field in the repeater "grant" $dollars = $pages->find("grants.amount_approved!=''");//grab pages whose repeater field "grants" value are more than 0 foreach ($dollars as $dollar) { $u = $dollar->grants; $total = 0; foreach ($u as $z) { $total += $z->amount_approved; } echo "Total grants: <span>\${$total}</span>"; } echo "</li>";//wrong? echo "</ul>"; Your <li>s also seem to be in the wrong place; but that's for later..
  20. A little confused here...are you saying the above is the code you are using? $page is a unique keyword/variable in PW and I believe should not be used in the foreach as you have done? Did you try this? foreach($pages->find("template=bustotorso-especial") as $brand) { $brand->of(false); // add this line $brand->save();
  21. I'm on XAMPP version 1.7.7. Avatar: Thx...yeah...thx to Horst for the avatar
  22. What I meant is I use the " Quick - display only the minimal options". I think you are using "Custom - display all possible options"? Below is the screen I see on XAMPP using the Quick Export...
  23. I never even go to the advanced settings...The simple export works fine for me..
×
×
  • Create New...