Jump to content

Galaxy

Members
  • Posts

    55
  • Joined

  • Last visited

Everything posted by Galaxy

  1. In the above scenario, I also need to output the total of combined fields called "amount_approved" - where would I put something like the following - on the list but referencing child pages? $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> ";
  2. I've got a template which creates a list of pages using the following it only returns "Logo not supplied" even if the image (logo) has been loaded. foreach($result as $child) { echo "<li>"; echo "<a href='{$child->url}'>{$child->title}</a>"; $image = $pages->logo; if (count($pages->logo)){ echo "Logo supplied"; } else{ echo "Logo not supplied"; } echo "</li>"; } I'm presuming it has something to do with the list being children.
  3. FYI above didn't work for me but the following did once I made sure it was set to handle multiple images echo "<img src='{$image->url}' class='thumb'>"; and without the { } it also worked.
  4. Hold on, yeah, it's working . I took a look at the field details tab "max files allowed" - it had 1. Changed to 0 and it's sweet. My bad.
  5. Nah, that throws up the same error Marty.
  6. Thanks Wanze, in debug mode <?php foreach($page->logo as $image) { echo "<img src='$image->url' class='thumb'>"; } ?> The message is Notice: Trying to get property of non-object in /var/www/vhosts/acumulus.co.nz/subdomains/legacytrust/httpdocs/site/templates/tabs.inc on line 20 line 20 is echo "<img src='$image->url' class='thumb'>";
  7. I usually use "logo" as both plural and singular. Southern family I blame it on...
  8. using foreach($page->images as $image) { echo "<img src='$image->url' class='thumb'>"; } loads the files that I've uploaded via the image type field named "images" Then for loading the logo files I've tried changing $page->images to $page->logo but that doesn't work for loading the image field "logo"
  9. I have different image types you might say. With each page I can upload a "logo" and a set of "standard" images. Hence, I have a field called "logo" where I upload the respective logo/s for that page. I also have another field called "images" (that handles images that aren't logos) On viewing the page I want to load the logo images only into a specific place (css handles the placement of course) but I need to just grab the logo image/s - not any of the "standard" type images (they load into other parts of the page). I want to target and load only the image that is uploaded view a field I've called "logo".
  10. I've created a field called "logo" and the type is "image" - and there may be multiple files uploaded via this field. How do I use this in a template? I've looked at http://processwire.com/api/fieldtypes/images/ but still can't work it out.
  11. (Note: I'd misguidedly edited this after getting it to work but Wanze and Diogo had answered - see following posts) Thanks Wanze This is what I've got that seems to output as required <?php $total = 0; foreach ($page->grants as $grant) { echo "<h2>{$grant->cheque_date} "; echo "\${$grant->amount_approved}</h2>"; $total += $grant->amount_approved; } $page->grants->sort('-cheque_date')->first()->cheque_date; echo "<p>Date of last grant: {$grant->cheque_date}</p> "; echo "<p>Total grants: {$total}</p> "; ?> thanks for your help dude
  12. Hi Wanze. Yeah I sort of see what you're saying but how do I make it work?
  13. Also, after listing all grants I want to grab the latest date a grant was made and the total of all grants and display them in an info box eg: Last grant made: 28 Feb 2013 (this grabs the most recent date from all grants) Total of all grants: $1100 (adds up all grants made) Any ideas?
  14. Yeah, both of those worked thanks. I have all working now. Changing the output format for the date field worked a treat and solved the 1970 issue... Cheers all.
  15. Hey slkwrm It wasn't really a typo - I need a $ symbol in front of the amount output. It works if I put a space after the first $ as in echo "<h2>Amount $ {$grant->amount_approved}</h2>"; but if the space is removed it doesn't work. What I had to do was this: echo "<h2>Amount $"; echo "{$grant->amount_approved}</h2>"; thanks for your input dude
  16. Thanks dude. But the output is now 1970: Date granted: 1970-01-01 12:00 Amount Date granted: 1970-01-01 12:00 Amount and I'm sure the field is correct - see:
  17. please excuse my ignorance but this isn't working for me. There is a field called "amount_approved" (see original attached screen capture) Also, I am unsure as how to format the date (I'm going to get some PHP lessons...)
  18. hey thanks but for <?php $total = 0; foreach ($page->grants as $grant) { echo "<p>Date granted: {$grant->cheque_date}</p>"; echo "<p>Amount ${$grant->amount_approved}</p>"; $total += $grant->amount_approved; } ?> It outputs no amounts and the date format eg. Date granted: 1360062000 Amount Date granted: 1361962800 Amount
  19. How do I target and output the data entered in repeater fields? I am using PW for a directory type website that shows how many grants organisations have recieved in donations from a community trust. Each time a recipient applies for a new grant we enter it via a repeater field called "grants" by selecting +add item - this creates a new set of fields that have date and amount approved. Potentially there could be half a dozen grants per recipient. Looking at an example - we have a field within a repeater (called "amount_approved) : <input id="Inputfield_amount_approved_repeater2038" class="FieldtypeInteger" type="text" size="10" value="500" name="amount_approved_repeater2038"> and the next field is a date input (called "cheque_date") <input id="Inputfield_cheque_date_repeater2038" class="InputfieldDatetimeDatepicker InputfieldDatetimeDatepicker3 hasDatepicker" type="text" data-ampm="1" data-ts="1360062000000" data-timeformat="" data-dateformat="yy-mm-dd" value="2013-02-06" size="25" name="cheque_date_repeater2038"> When we create a new set by using +add new item under a repeater set, the same field in the next new repeater is <input id="Inputfield_amount_approved_repeater2039" class="FieldtypeInteger" type="text" size="10" value="600" name="amount_approved_repeater2039"> and the date field in the same repeater <input id="Inputfield_cheque_date_repeater2039" class="InputfieldDatetimeDatepicker InputfieldDatetimeDatepicker3 hasDatepicker" type="text" data-ampm="1" data-ts="1361962800000" data-timeformat="" data-dateformat="yy-mm-dd" value="2013-02-28" size="25" name="cheque_date_repeater2039"> In this case PW added the unique "repeater2039" and "repeater2038" to the ID and the name of the fields. (see attached screenshot of how the repeaters/fields look in admin edit mode) So now to display these via the template - how can I output these variables to look something like this: Date granted: 06 Feb 2013 Amount: $500 Date granted: 28 Feb 2013 Amount: $600 Also, I want to grab the latest date a grant was made and the total of all grants and display them: Last grant made: 28 Feb 2013 Total of all grants: $1100 Thanks for any help on this.
  20. yeah, sorry, I wanted editors to be able to add a child page (company) of a parent (company list). so, I did what you said: and indeed it works! Cheers dude
  21. I've created a role called "editor" whose permissions are set to do 4 things - view, edit, delete and create pages. I've given this role to a test user. Then created a template that has "view pages", "edit pages and "create pages" for the editor role selected in the access tab ( this template is used for 112 company info type pages) But, the user can't add a new page (company).
  22. ...why didn't I see if something existed? Thanks dude, it works a treat. You are a legend!
×
×
  • Create New...