Jump to content

Galaxy

Members
  • Posts

    55
  • Joined

  • Last visited

About Galaxy

  • Birthday 12/14/1965

Profile Information

  • Gender
    Male
  • Location
    Aotearoa, NZ
  • Interests
    Old Punk Rock and New Suede Shoes

Galaxy's Achievements

Full Member

Full Member (4/6)

6

Reputation

  1. Thanks again. I feel like I owe ya something....
  2. added, and all good. Thanks guys. Love your work. foreach($result as $child) { echo "<li>"; 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>"; } // and from here on do the same as you did in the individual page, but adapted ($page is now $child) $total = 0; foreach ($child->grants as $grant) { $total += $grant->amount_approved; } echo "Total grants: <span>\${$total}</span>"; echo "</li>"; }
  3. No! See the above dude. You guys are funny. Love your work but I still have to tweak this...
  4. Hold on a minute!! I think it's now adding up each and creating a running total... http://legacytrust.acumulus.co.nz/recipient-list/ see how the numbers combine and increase down the list
  5. Hallelujah diogo! And, thanks Kongondo for perservering with this. This indeed works:
  6. Kongondo if I do like you suggest No totals appear so I've got echo "<ul class='nav'>"; echo "<li>"; foreach($result as $child) { 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>"; } $dollars = $pages->find("grants.amount_approved!=''"); 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>"; echo "</ul>"; note: moved the <li> to outside all foreach I feel like it's getting close... might be the 4th coffee this morning... kongondo Yes!
  7. have you refreshed http://legacytrust.acumulus.co.nz/recipient-list/ It's showing all the individual items totals...
  8. My head is spinning and I'm sure my explanations are being misinterpreted somehow and I apologise, but here goes... On an individual page (eg. http://legacytrust.acumulus.co.nz/recipient-list/1st-otumoetai-scouts/ ) You'll see how it has 2 grants (with their dates) and their total 1. 1 August 2012 $1000 2. 1 Junwe 2013 $500 Total grants: $1500 This is fine and is using the following echo "<ol>"; foreach ($page->grants as $grant) { echo "<li>{$grant->cheque_date} "; echo "<span>\${$grant->amount_approved}</span></li>"; $total += $grant->amount_approved; } echo "</ol>"; echo "<h3>Total grants: <span>\${$total}</span></h3> "; $last_cheque_date = $page->grants->sort('-cheque_date')->first()->cheque_date; echo "<p>The most recent cheque date is <span>{$last_cheque_date}</span>.</p>"; Now, go back to the Recipient list http://legacytrust.acumulus.co.nz/recipient-list/ All I want to do is have the total of each individual's grants within its own <li> after the link to its own page and the icon to show if a logo has been uploaded.
  9. getting there but... http://legacytrust.acumulus.co.nz/recipient-list/ this is the complete list code echo "<ul class='nav'>"; foreach($result as $child) { echo "<li>"; 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>"; } $dollars = $pages->find("grants.amount_approved!=''"); 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>"; } echo "</ul>";
  10. so I've got this $total = 0; //grants = name of repeater; amount_approved = name of a field in the repeater "grant" $dollars = $pages->find("grants.amount_approved!='', parent=$page"); foreach ($dollars as $dollar) { $total += $dollar->amount_approved; } echo "Total grants: <span>\${$total}</span>"; but all items output $0
  11. Right. I couldn't have said it better myself
  12. A list of all Recipients - which are child pages of the Recipient (what I call) category. Sorry I though my first post explained the scenario http://legacytrust.acumulus.co.nz/recipient-list/
  13. no I want totals for each item on the list (each item is a page). On the individual page, the following successfully shows all grants and the total of all the grants. Which prooves the fileds are not empty. $total = 0; echo "<ol>"; foreach ($page->grants as $grant) { echo "<li>{$grant->cheque_date} "; echo "<span>\${$grant->amount_approved}</span></li>"; $total += $grant->amount_approved; } echo "</ol>"; echo "<h3>Total grants: <span>\${$total}</span></h3> "; when you are on the list page I want it to show a summary beside the link to each individual page. It looks like it ahs totalled ALL the amounts_approved from all child pages. So yeah, I can use this as the grand total, but it's not what I want beside each page listing.
  14. yeah I took everything out except $total = 0; //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; foreach ($u as $z) { $total += $z->amount_approved; } } echo "Total grants: <span>\${$total}</span>"; and it created 1 output only with Total grants: $798684
×
×
  • Create New...