Jump to content

adrian

PW-Moderators
  • Posts

    10,784
  • Joined

  • Last visited

  • Days Won

    346

Everything posted by adrian

  1. PS There was a slight omission in my original code. I missed the counter to up the value of $i on each loop. This should work just fine to echo out the first four images $i=0; foreach($page->imageK1 as $image){ if($i==4) break; echo "<a class='fancybox' rel='gallery1' href='$image->url'>"; echo "<img src='$image->url' height='150'></a>" $i++; }
  2. If you're using Soma's slice approach, you need to use your image field: imageK1 echo $images = $page->imageK1->slice(0,3); Did you try $page->imageK1->eq(1)->url; rather than those first(x) which won't work because of what Soma mentioned?
  3. There are a few ways you could do this, but this approach is pretty straight-forward: $i=0; foreach($page->imageK1 as $image){ if($i==4) break; echo $image->url; } Or if you do want to specify the second image, you are looking for ->eq(1), remembering that numbering starts from 0, so 1 is actually the second image. EDIT: Sorry, see corrected code below: http://processwire.com/talk/topic/5359-acces-picture-1-to-4-of-an-imagefield/?p=51662
  4. Hey Soma, that has also bugged me a little about my module. The reason I went with that approach was to support users entering select options using Option 2: Option 2. MULTIPLE FIELDS - the first line is used for the field names and the first field must be 'Title'. Subsequent lines are the values for the fields, eg: Title, Number of Beds, Number of People, Kitchen Facilities Single, 1, 1, Fridge Only Double, 2, 2, Fridge Only Suite, 3, 6, Full Kitchen Obviously in this case it isn't possible to re-use existing templates. However, I would definitely like to improve the module so that if you're using Option 1: Option 1. TITLE FIELD ONLY - enter one option per line, eg: Single Double Suite you could specify the existing parent and child template to use. Do you have any specific suggestions that you think would be best practice? I am going to make my goal for the next release to be able to add "As used by Soma" to the module description EDIT: New version now allows for re-use of templates and also automatic creation of manually named templates if you want to override the automatically generated names (which are based on the field title).
  5. You should definitely look through that video and understand how these are built - it will be a great learning experience into how PW works, but once you do know, you can cheat with this module that allows very quick setup of all the different select types: http://modules.processwire.com/modules/process-page-field-select-creator/
  6. Hey Ryan - the small square isn't all the time and I think it may not be happening with more recent dev versions now that the background on the dropdowns is solid and there isn't a border property? Doesn't matter anyway now that you've fixed the permissions I agree with you in principle that generally sites shouldn't open new tabs/windows, but I think users have come to expect that links to external sites and internal links that can break a form submission will be in a new tab/window. Maybe it isn't critical in this case since it is a backend link and even content authors should be able to get used to it.
  7. Thanks Soma, I was trying to remember that option last night, but couldn't remember exactly what it was, or where I had used it.
  8. Hey Macrura, if I understand correctly, this module is working on the Admin, so you need to get the template of the page that is being edited. If you do $page->template / wire('page')->template, it won't work, because this will be the template of the "Edit" page, which will be the admin template. What you need to do is something like this: $page_id = (int) wire('input')->get('id'); $edited_page = wire('pages')->get($page_id); if($edited_page->template != 'camp') return; I think that should do the trick!
  9. More importantly, that Type Wonder site looks awesome - what a great idea!
  10. Also, don't forget about PW's $session variable, which may also come in handy in addition to cookies, or instead of, depending on your needs.
  11. Sounds like a good solution to me - the only thing you should need to pass to the form is the ID of the product (and maybe the number of them they are buying). You can grab all the other details via the PW API once you are at the form - you can even echo these out above the form so the user is sure of what they are buying. Then you can send these details to the form submission processing script to be used in the email via hidden form fields, or just get those details again from the product ID. If you are building a shopping cart with multiple items, then obviously you'll want to make use of cookies to store the product IDs and the number they are buying. Then the form script would read the cookies.
  12. Well there are lots of options here, but based on your first post it sounds like you'll be having them submit a form and then send the email, so all you need to do is include the code to send the email in the script that processes the form submission, which would then presumable redirect to another page to say their order/payment has been received. You could also send an email via an AJAX call. Lots of options, but if you have a more detailed question, let us know. You could certainly use a PW field, or a series of fields to contain the various components of the email so these are editable by your site authors. Hope that helps.
  13. You can use PHP's default mail function: $to = 'nobody@example.com'; $subject = 'the subject'; $message = 'hello'; $headers = 'From: webmaster@example.com' . "\r\n" . 'Reply-To: webmaster@example.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); But personally I would recommend installing the free SwiftMailer class (swiftmailer.org). It is incredibly powerful and can easily send mail using SMTP, can include both HTML and plain text versions in the one send, allow you to add attachments which is great if you are using a PHP PDF generating class to automatically generate a receipt, and lots more!
  14. I think something like this should do what you want: echo date("j. F Y", $pages->get("sort=-modified")->modified); It finds the last modified page. You can of course change this to created and also limit to various templates, parents, etc if you want.
  15. What version of PW are you running? Does this post help - Ryan has a fix for the current stable: http://processwire.com/talk/topic/4384-cant-empty-trash-or-delete-indivdual-trashed-pages/ PS In case you don't know, the search mechanism in this forum is not great, but the following search in google works a treat: site:processwire.com "Call to a member function hasRole() on a non-object"
  16. This should do what you want: RewriteCond %{THE_REQUEST} ^.*/index.php RewriteRule ^(.*)index.php$ /$1 [R=301,L]
  17. Fair enough. Just in case you don't know, that module does easily support manual creation of the link. Based on it's default configuration you could do something like: http://www.ourdomain.com/r/aprilevent2014/ but you can change the "r" to something else if you wish. Regardless, maybe the redirects module is cleaner for your needs.
  18. It really is a great looking color scheme. I love that you've built a modern site that is still so functional. I have to admit to being more than a little frustrated by some of the current interfaces being developed these days. Great job!
  19. Ipa, Have you seen this module: http://modules.processwire.com/modules/link-shortener/ I think this would be a perfect use case for it.
  20. Noticed an issue with the dropdowns and user permissions. I gave an non-superuser permission to administer users. The Access menu then appears, but nothing drops down from it, other than a small square - just a few pixels in size. The same thing actually happens when I add a "Tools" main menu item using diogo's Custom Admin Pages module. Again, the dropdown won't work unless the user is a superuser. On an unrelated note, I think the new site link should open in a new tab by default so no-one will lose any unsaved edits.
  21. Just wanted to confirm that I am seeing the same issue as Macrura. If you need a quick fix for a live site, you can grab the templates-admin folder from the last PW version before Ryan introduced the module theme technique and this module will look as expected again.
  22. Here is apparently a working solution for Infinite Scroll in PW: http://processwire.com/talk/topic/5189-pagination-markup-question/?p=50019
  23. Yep, you can definitely customize the fields from the events example. That module, although useful in its own right, was meant as an example to be modified to your needs. Let us know if you have more questions once you dive in!
  24. Glad to help. Just one thing - from what you describe, it sounds like you are editing the core ProcessPageAdd module. You don't want to do this, because you'll have to make these changes again every time you upgrade PW. Instead you should create your own simple module using that code. Read here for a tutorial on creating your own module: http://wiki.processwire.com/index.php/Module_Creation
  25. Gotcha - I had seen that code of Pete's sometime ago, but had forgotten about it.
×
×
  • Create New...