-
Posts
7,529 -
Joined
-
Last visited
-
Days Won
160
Everything posted by kongondo
-
Why reinvent the wheel? Of course you can do that. I just prefer using phpMyAdmin for this
-
Adding total field amounts based on child fields
kongondo replied to Galaxy's topic in Getting Started
@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) -
Adding total field amounts based on child fields
kongondo replied to Galaxy's topic in Getting Started
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.. -
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();
-
I'm on XAMPP version 1.7.7. Avatar: Thx...yeah...thx to Horst for the avatar
-
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...
-
I never even go to the advanced settings...The simple export works fine for me..
-
How to output the selected field items in a Repeater field?
kongondo replied to gtoirog's topic in Getting Started
If it works for you, well, and if there are no severe strains on your server and if you've thought this through, then, yes....But, as has been said before, repeaters were designed for something else and not to categorise content...Most people here will categorise content using methods stated above...it is good practice.. I'm sure you've seen this: -
Adding total field amounts based on child fields
kongondo replied to Galaxy's topic in Getting Started
Change the following code... $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>"; to //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>"; } -
Adding total field amounts based on child fields
kongondo replied to Galaxy's topic in Getting Started
OK, Is the following the situation? So, your tree goes something like... recipient acorn foundation althorp trust aglow int abilities in action 1st O. scouts Each of those child recipient pages (aglow, etc.). have several repeater fields. And, adding the totals on each child page (e.g. aglow) adds up fine with the code on your first post And, now you want to pull those child totals and list them as shown in the link to recipient list? E.g. aglow $1000 acorn foundation $4000 althorp trust $7000 Right? -
DB Host = localhost. Maybe? Edit: forgot the host part...thanks horst!
-
Adding total field amounts based on child fields
kongondo replied to Galaxy's topic in Getting Started
OK...I am now getting you partially...My code does the grand total across the whole site... I am not getting what you mean by list page.please explain..What is on that list? A list of ALL grants across the site? A list of ALL grants in a category (e.g. international grants)....an illustration would help I have a feeling it is about choosing the right selector (e.g. templates="xyz" or parent="123"). Try adding the parent of the listed pages (assuming I get you correctly) to the selector..., i.e. parent=ID of parent or path/to/parent Edit: if there are various parent pages that will have various listings of grants of their child pages, then try to add this to your selector.. $dollars = $pages->find("grants.amount_approved!='', parent=$page "); -
Adding total field amounts based on child fields
kongondo replied to Galaxy's topic in Getting Started
You've checked your fields are not empty? What type of text field is that? What do you mean it created one output? How many outputs do you want? I thought you wanted one grand total on the parent page? Is $798684 the correct amount for the grand total? -
Adding total field amounts based on child fields
kongondo replied to Galaxy's topic in Getting Started
Strange...and without the ' '? i.e. != instead of !=' '....just guessing here... Edit: What about as standalone? Does the totals code work? -
Adding total field amounts based on child fields
kongondo replied to Galaxy's topic in Getting Started
To use it with > or < it has to be an integer I believe. I think it works better with integers if you are comparing numbers . If you still want to use a text area, you can check if the text area is empty or you can do something like below. I am not sure if it will work correctly though... $dollars = $pages->find("grants.amount_approved !=0"); //OR $dollars = $pages->find("grants.amount_approved!=''"); Briefly tested... -
Nice! +1 one for separation of core and site...
-
Better image management / better integration with WYSIWYG
kongondo replied to mindplay.dk's topic in Wishlist & Roadmap
@Macrura, What Editor is that? -
I think this is answered here http://processwire.com/talk/topic/3938-adding-total-field-amounts-based-on-child-fields/
-
How to output the selected field items in a Repeater field?
kongondo replied to gtoirog's topic in Getting Started
Hi gtoirog, Welcome to PW and the forums! totoff is right; you don't want to use repeater fields to categorise content. I don't know how much reading you've done (about PW). This thread would be useful for categorising content. May I also suggest, it is (at least for me) easier to understand what you are trying to achieve if it can be visualised. So, something like how you tree structure looks like and the relationships you are trying to take advantage of helps. Eg. My tree looks like this: Home plants Species Color Etc -
Adding total field amounts based on child fields
kongondo replied to Galaxy's topic in Getting Started
Hi Galaxy, The following should work (tweak the example). You need to get arrays within arrays...hence, nested foreach.... $total = 0; //grant = name of repeater; grants = name of an integer field in the repeater "grant" $monies = $pages->find("grant.grants>0");//grab pages whose repeater field "grants" value are more than 0 foreach ($monies as $peso) { $u = $peso->grant; foreach ($u as $z) { $total += $z->grants; } } echo "<h3>Total grants: <span>\${$total}</span></h3><hr> "; -
I didn't know this. Thx Teppo...I need to click on the "wrench" in the modules list more often!
-
Adding total field amounts based on child fields
kongondo replied to Galaxy's topic in Getting Started
You need to implement that similar to the examples found here...about repeaters.. For example: foreach ($pages->find("grants.amount_approved>0") as $grant) { //do stuff } //where, grants = the name of your repeater field; and amount_approved is the name of the field within the repeater field containing the amounts $ Hope this helps...it is just an example -
Adding total field amounts based on child fields
kongondo replied to Galaxy's topic in Getting Started
Have you tested with something similar to... $total = 0; foreach ($pages->find("template=recipients, limit=10") as $grant) { $total += $grant->amount_approved; } echo "<h3>Total grants: <span>\${$total}</span></h3> "; //or, find using parent="/path/to/parent/" or parent=123 This works for me using normal integer fields in child pages. From what I recall, repeaters are accessed the same way as fields in other pages... -
Adding total field amounts based on child fields
kongondo replied to Galaxy's topic in Getting Started
click edit, then click use full editor, then edit topic title -
Changing a topic title if no one getsthe original
kongondo replied to Galaxy's topic in Getting Started
click edit, then click use full editor, then change the title...