Jump to content

adrian

PW-Moderators
  • Posts

    10,797
  • Joined

  • Last visited

  • Days Won

    346

Everything posted by adrian

  1. Sorry you had no luck with that class. It has been working well for me - several hundred PDFs with no failures so far. I have attached one that definitely works so maybe you can figure out what the issue might be. EDIT: Notice that in the main function I changed it so it always uses the handleV2 function. The V3 one wasn't working for me, but you might want to look into that some more. ian_newsletter_405 (2).pdf
  2. Looks good to me. The only feedback I have is that you could ditch the first line and replace $section in the second line with $page.
  3. Looking forward to checking this out - thanks! I have been using the attached set of functions for a long time to extract text from PDFs. Probably not as powerful as poppler, but might do what you need. I made some poorly documented changes to the original. Anyway, maybe you'll find something useful in there. pdf2txt.php
  4. Thanks diogo - I hadn't actually used the admin search function before. Works a treat, although I still like the idea of column sorting spanning all users, rather than just those on the current page.
  5. One of my PW site has a LOT of users and I am finding myself wanting a way to find a user in the admin user interface. Search would be nice, but at a minimum, it would be good if the column sort functionality worked across all pages, not just the currently displayed one. I don't think this is currently possible, is it? Not sure if this should be a module or a core enhancement. Thanks, Adrian
  6. Due to scope, you need to use wire('config') inside a function. Same is true for all the PW variables: http://processwire.com/api/variables/ If you'll be using it a lot in the function, you can do $config = wire('config') and then use $config as normal after that.
  7. As an alternative, have you tried Ryan's Youtube/Vimeo module: http://modules.processwire.com/modules/textformatter-video-embed/
  8. All good points Teppo. I knew I shouldn't have posted late at night I am using the description field to automatically generate captions. Title is obviously a much more appropriate option for this, but either way it would be nice to have a simpler way to do this. But you are right - not appropriate for storing with the image itself due to the possibility of using the image in multiple places/contexts.
  9. I think it would be useful if changes to an image's description field automatically propagated to the alt tag when embedded in an RTE textarea. At the moment you need to select the image, click the select image button and then "insert this image". This will force the ALT tag to update, but I think it would be good if this step wasn't necessary. I don't think there are any negatives to this, but maybe I haven't thought it through. Also (and I think this has been brought up before), I think we need a title field for images. Thanks
  10. Ok, I have ChromePhpLogger installed. Catch is that nothing gets logged because nothing is sent to the browser when I am logged in. When logged out, or that section of code is commented out, it works fine. The one error I do get (in Firebug) is: status: aborted
  11. No, I have used FirePHP in the past, but since switching to Chrome I haven't got ramped up on that front yet. Doing a million different things at the moment, but will get it installed and see if I can figure it out.
  12. This is actually more complicated than I thought. Turns out all that clearing "Delete cookies and other site and plug-in data" did was log me out. The page works fine when logged out, but produces the error when logged in. Something as simple as: $markers = $pages->get("/schools/")->children(); foreach($markers as $item) { error_log($item->sister_school->id); generates the error. sister_school is a page field (single) select. The error log receives a list of all the sister_school ids. There are no php errors generated. Currently baffled - will let you all know if I figure it out!
  13. Thanks Ryan, I will stop bugging you with these sorts of "fringe" requests and start getting some modules produced. I have lots of ideas
  14. I don't think that should be a problem. I think you should just have to edit: foreach($mypage->fields as $f) { $mypage->set($f->name, $form->get($f->name)->value); } to iterate through the fields from the $input->post, assuming the fields already exist in the backend. Even if they don't you could easily add them through a foreach that uses the posted form data. Might be a little fiddly, but not too difficult.
  15. Not sure if you want to go with diogo's option in that thread I linked to, but I just remembered - be sure to check out the last comment in that thread by me, because there is one change that should be made (fix a non-fatal error), and one key one (saving the page) that has to be made I have found his approach really great for front-end forms - if you're still having troubles, I'd definitely revisit it as an option!
  16. Is it possible that there is a discrepancy between the fields "Dereference in API as" and its "Input field type". ie is one multi and the other singular? If singular, try the "Single page (Page) or boolean false when none selected" option instead of the other one. I found I had to use this the other day - don't remember why but it worked for me
  17. I figured they already existed for you. I don't think you can specify the page ID. I think you need to assign the page array itself. In my example above you can see that I assign: $newpage->organization = $neworganization where $newpage->organization is the "organization" page field from the page that was just created for the user's form submission and $neworganziation is the page array, rather than the ID of the page (I think that is right and makes sense )
  18. onjegolders - I know this is not answering your question directly, but I have been doing a lot of front-end forms direct from templates using this code from diogo as a starter: http://processwire.com/talk/topic/59-module-want-form-builder/?p=11639 It lets PW take care of building and submitting the form. If you need to it is very easy to manipulate data before submission with some conditional statements in the final foreach eg: foreach($mypage->fields as $f) { if($condition_met){ $mypage->set($f->name, transform_result($form->get($f->name)->value))); } else{ $mypage->set($f->name, $form->get($f->name)->value); } } Back to your original question, I have sent pagefield data to the DB like this. This allows the user to add a new option (child) to the page field and then it populates that new value to the selected field. My point is that if you are doing things manually like you are, I think you need to pass an actual "page" to the field - like I have done with: $newpage->organization = $neworganization; $neworganization = new Page(); $neworganization->template = $templates->get("organization"); $neworganization->parent = $pages->get("/organizations/"); $neworganization->of(false); $neworganization->name = $sanitizer->pageName($form->get($f->name)->value); $neworganization->title = $sanitizer->text($form->get($f->name)->value); $neworganization->save(); // Save the new organization as a child in the organizations page $newpage->organization = $neworganization; //add it to the main organization field $newpage->organization_other = ''; //empty the organization_other field - no longer needed since it is now in the main organization field Anyway, hope that provides some insight into what the problem might be (in a roundabout kinda way). I would definitely suggest using that code from diogo though - it works beautifully
  19. artaylor, Not really sure if this is related or not, but the instructions for setting up the comments module are missing a step. Did you add the new comments field to the template for the page?
  20. Sorry Ryan, I wasn't very clear on this - I was referring to the pathinfo options in php for: dirname basename extension filename Because I don't know what the extension is, I actually used which works great. pathinfo($file->filename,PATHINFO_FILENAME) I am fine with using this, rather than needing PW option. I think what prompted this email was the description in the API cheatsheet for $file->name which says: "Returns the filename without the path (basename)". I thought it would be nice if $file->name became $file->basename to make this clearer for those people used to PHP. Then it just seemed logical to have the other pathinfo options also availble. Anyway, really no big deal at all - just thinking out loud really
  21. nik - true - I should maybe have explained the need for an SQL JOIN. I actually hadn't considered the other benefits of using a selector - good to note, thanks!
  22. It is also very easy to use SQL in these sorts of situations. Have a read of this thread: http://processwire.com/talk/topic/3053-possible-to-select-modifiedcreated/?p=30093
  23. Hi Martijn, Afraid I am not really understanding your suggestion. What I am wanting to do is make sure that when an admin user uploads a new version of the same file (with the same filename) that PW doesn't append a '1' etc to the filename. I could tell the user to delete the file first, then save the page and it will work as I want, but I am trying to avoid them having to do that step. It sounds like maybe you are talking about a front-end upload?
  24. Hey Nico - thanks for the suggestion, but the page worked in other browsers and even an incognito Chrome window. Once the cookies/cache were cleared it also worked fine in a standard Chrome window. So it was all solved with no code changes. The weird thing though is that there was that one line of code that could be removed and it would load in standard Chrome window as well. I even had a live version of the site (as opposed to the dev version) with exactly the same code on that page that also worked fine. Anyway, my post here was really just a general heads up in case someone else gets this error. I do like Chrome, but I find its aggressive caching annoying at times. One other thing I did in fixing this page is flush the DNS cache in chrome and my OS. I don't think this is related but it was suggested when I was researching the no data received error!
  25. Thanks Wanze, Was hoping there was a PW way. I ended up using the following: $images = $page->$image_field->getArray(); natsort($images); $reversed_images = array_reverse($images); $sortedImages = new WireArray(); $sortedImages->import($reversed_images); $page->$image_field = $sortedImages; I had to reverse the array, I am guessing because of the way import brings them in, so that they are in the correct ascending order. After the final line I make a few more changes to the $page and then save it. Anyway, this seems to work fine.
×
×
  • Create New...