Jump to content

MarcC

Members
  • Posts

    380
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by MarcC

  1. I have a client who had a previous site where they were just pasting analytics code (two types) into TinyMCE, so now all of their bodytext fields are kind of polluted with that stuff. What's a good way to remove this--assuming it'd be best just to do it using the PW API? These are script tags bracketed by HTML comments.
  2. Pretty blown away by all the help! Horst, I'm excited to check out the module. Sorry for the late reply but I really appreciate this. Marty, great looking photo site and thanks for sharing the way it works. Congrats on being featured in the e-newsletter.
  3. Wow, very interesting information here, guys. Thanks very much. It seems like EXIF data gets stripped pretty easily. Here are some questions: 1. Is anybody doing a combination like: Attempt to read EXIF but fallback to custom fields for focal length, f-stop, etc. if EXIF data isn't available? 2. GD strips EXIF tags, but that only applies to resized/cropped extra versions of the image, right? Like those automatically created in the assets folder? Or does it somehow strip EXIF tags from the original as uploaded? Hope I understood correctly Thanks!
  4. I'm considering a project where I may need to extract EXIF data from images and display it on a site. I've looked over methods of collecting the data, like external classes, and it seems fairly straightforward. But I'm wondering if there's any reason I can't use the Images fieldtype (and accompanying methods to resize) with tools like these, or anything else I should know? If anybody has experience with this, I'd appreciate any information you can share.
  5. I wondered if it would be possible to use e.g. the Inspector together, to modify a website and talk about changes, but I'm guessing not?
  6. Nice work. Keep in mind that you can use e.g. another approach like a single main.php file. I think Soma explains it pretty well.
  7. I see what you did there
  8. I like the convenience of using the find method for simple search purposes, but I can see cases where a more formal search tool would actually save time. Good points.
  9. It's sort of looking like no to me in the default setup, but maybe you can just create your own special password fieldtype with different requirements? That's a module, after all.
  10. You might be able to pull this off in the text editor, but it'd be pretty volatile. I have no idea what purpose that data serves, or who would update it and how often, but all that aside it looks like the sort of thing I would do with PHP using the API.
  11. Thanks for sharing the list--It's neat that he points out ways people have found to implement similar features. That sort of content deserves a better website I get PHP Classes emails but can barely stand to read them.
  12. Wow, cool site, thanks diogo! No credit for the illustrations though, that's kind of weird.
  13. MarcC

    hhhhold.com

    I started using lorempixel yesterday, and I like that they have different categories of images. So I can do lorempixel.com/640/480/sports/3 to get the third image from the "sports" category. That's very helpful and allows you to get closer to what a client might have in mind I do like that hhhhold lets you specify dark/bright and the JS thing is cool.
  14. Any big problems if I was to use the dev branch?
  15. Hey soma, is this fixable? I looked at it with the inspector really quick but didn't see an easy fix. Thanks. (Chrome / Mac OS)
  16. Nice job. Thanks man.
  17. This is the current module code after more changes: <?php class AutoArchive extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Project Auto-Archiver', 'summary' => 'If the page is saved and the project_status field is set to completed, archive it. If the project is in the archive and has its status changed away from completed, unarchive it.', 'version' => 1, 'autoload' => true ); } public function init() { $this->pages->addHookAfter('save', $this, 'hookSave'); } public function hookSave(HookEvent $event) { $page = $event->arguments[0]; //This has nothing to do with you, non-project pages. if($page->template->name != 'projects') return; // If the project is not marked as complete and it's already archived, move it back to the normal projects area. if ($page->project_status->id != 1157 && $page->parent->name == 'projects-archive') { $page->parent = $this->pages->get(1131); //projects page $page->save(); $this->message("Moved out of archive. New page location: {$page->url}"); } // If it is marked as complete, and not in the archive yet, archive it. if ($page->project_status->id == 1157 && $page->parent->name != 'projects-archive') { $page->parent = $this->pages->get(1322); //move under projects archive page $page->save(); $this->message("Archived. New page location: {$page->url}"); } } } ?>
  18. Ha ha, awesome Ryan. I wondered about both of those things. Actually I think I should probably just remove the remove() part anyway. I can't see why it's necessary now to null out the page field, when I have added new logic to test whether the page is already in the archive or not. //This has nothing to do with you, non-project pages. if(!$page->template != 'project') return; // No need to to anything if project is not marked as complete. // I checked my sample project and its ID returns 1157. if ($page->project_status->id != 1157 && $page->parent->name == 'projects-archive') { //marked as incomplete and it's in the archive. Get it back to the projects page. //$page->project_status = null; // remove the status $page->parent = $this->pages->get(1131); //projects page $page->save(); $this->message("Moved out of archive. New page location: {$page->url}"); } // If it is marked as complete / 1157, then we remove the marked as complete part (this avoids pagesave loop) if ($page->project_status->id == 1157 && $page->parent->name != 'projects-archive') { //completed and not in archive. move to archive. //$page->project_status = null; // remove the status $page->parent = $this->pages->get(1322); //projects archive page $page->save(); $this->message("Archived. New page location: {$page->url}"); } Is there something I can (or should) do about the "Saved" message that shows an incorrect parent after the module just changed the parent? I have two messages now, the Saved Page message and my own message saying there's a new parent. Thanks!
  19. Well, solved it by trying something I found in Ryan's docs. I noticed that $event->object didn't seem to be storing any ID or name data. So instead of using $page = $event->object, I tried $page = $event->arguments[0] and it worked. ProcessWire's save message still says it's saved under the old parent, which is kind of weird since it's just been moved under a different parent, so if anybody knows a workaround, let me know. (Edit: Added a $this->message, which helps but they still see 2 separate save messages) Final changes: (Would love any feedback you have) $page = $event->arguments[0]; // No need to to anything if project is not marked as complete. // I checked my sample project and its ID returns 1157. if ($page->project_status->id != 1157 && $page->parent->name == 'projects-archive') { //not completed and it's in the archive. Get it back to the projects page. $page->project_status->remove(); $page->parent = $this->pages->get(1131); //projects page $page->save(); } elseif ($page->project_status->id != 1157) { //just a normal page. return; } // If it is marked as complete / 1157, then we remove the marked as complete part (this avoids pagesave loop) if ($page->project_status->id == 1157 && $page->parent->name != 'projects-archive') { //completed and not in archive. move to archive. $page->project_status->remove(1157); $page->parent = $this->pages->get(1322); //projects archive page $page->save(); }
  20. Actually it looks like the test is failing: if ($page->project_status->id == 1157) ...is returning false. But that is the ID that the field contains. Weird. And when I echo that variable elsewhere (just as a test), it comes up as 1157. Help!
  21. Thanks Wanze--that results in: Error Call to a member function remove() on a non-object And no white page. So it does seem like it is trying to work. Field type is single page or boolean false when none selected. Code so far: <?php class AutoArchive extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Move page to archive after saving it with certain value', 'summary' => 'It can\'t be this simple.', 'version' => 1, 'autoload' => true ); } public function init() { $this->pages->addHookAfter('save', $this, 'hookSave'); } public function hookSave(HookEvent $event) { $page = $event->object; // No need to to anything if project is not marked as complete. // I checked my sample project and its ID returns 1157. if ($page->project_status->id == 1157) die("Hook gets executed..."); // If it is marked as complete / 1157, then we remove the marked as complete part (this avoids pagesave loop) $statusPage = wire('pages')->get(1157); $page->project_status->remove($statusPage); $page->parent = $this->pages->get("/projects-archive/"); $page->save(); } } ?>
  22. Right, page 1157 is titled "Completed"--does that make sense? project_status is the page field. I hope I understood what you're saying.
  23. Hey apeisa, I installed the module but it's not archiving. Any ideas? Error logs are clean and I've adjusted the code to fit the corresponding field. <?php class AutoArchive extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Move page to archive after saving it with certain value', 'summary' => 'It can\'t be this simple.', 'version' => 1, 'autoload' => true ); } public function init() { $this->pages->addHookAfter('save', $this, 'hookSave'); } public function hookSave(HookEvent $event) { $page = $event->object; // No need to to anything if project is not marked as complete. // I checked my sample project and its ID returns 1157. // But it doesn't get archived (placed under the projects-archive parent) when saved. if ($page->project_status->id != 1157) return; // If it is marked as complete / 1157, then we remove the marked as complete part (this avoids pagesave loop) $page->project_status->remove(1157); $page->parent = $this->pages->get("/projects-archive/"); $page->save(); } } ?> Not sure how to use breakpoints or something similar for modules, or I would have tried that. Thanks.
  24. Hey, that's really cool. Thanks.
  25. What about a simple blog tutorial? That might be more flexible than a profile. Especially if you are building on an existing PW site. It's really straightforward to set up something like that.
×
×
  • Create New...