BitPoet

Members
  • Content Count

    872
  • Joined

  • Last visited

  • Days Won

    40

BitPoet last won the day on January 24

BitPoet had the most liked content!

Community Reputation

2,047 Excellent

1 Follower

About BitPoet

  • Rank
    Hero Member

Profile Information

  • Gender
    Male
  • Location
    Near Munich / Germany
  • Interests
    programming, writing, scuba diving, long distance hiking

Recent Profile Visitors

5,388 profile views
  1. BitPoet

    Using .htaccess is efficient. You could, in theory, handle (nearly) everything in PHP, but this would add serious overhead, both memory and speed wise. Others have adapted the rules for NGINX, a few like me use IIS with URL Rewrite to power PW, but in all cases, it makes sense to filter and rewrite requests in the web server itself. The topic of supporting more platforms than just Apache out of the box has been brought up a few times already here in the forums. Ryan himself is not opposed to it, but he lacks the time to develop and test the rule sets, and he is of course wary of including anything that hasn't been well tested or that might end up without active support (any changes he makes for .htaccess need to be quickly adapted for other platforms). So I guess it would need a team of knowledgeable volunteers who develop the rules, adapt the installer script, test everything well and provide quick support before he considers integration into the PW project.
  2. BitPoet

    Perhaps you can use TracyDebugger and output (bd) whatever you pass to isChanged in your hook?
  3. @pout: even the regular WireMail class shouldn't cause such problems, so it would be good if we could narrow the cause down. Could you check if the issue is still there if you add the following line after the one @adrian linked to: $mail->set("newline", "\n");
  4. This looks okay. You just need to get the correct image from the page. For performance reasons, I'd build an intermediate array that groups the images by page, as you have to load each page into memory to retrieve the image. This way, you can uncache the page after you have rebuilt all its variations. Untested: $query = $this->database->prepare('SELECT name FROM FIELDS WHERE TYPE = "FieldtypeImage"'); $query->execute(); $results = $query->fetchAll(); $pageimgdata = []; foreach ($results as $row) { $query = $this->database->prepare('SELECT * FROM FIELD_'.$row[0]); $query->execute(); $images = $query->fetchAll(); foreach($images as $image){ $pageid = $images["pages_id"]; $filename = $images["data"]; if(! isset($pageimgdata[$pageid])) $pageimgdata[$pageid] = []; $pageimgdata[$pageid][] = $filename; } } foreach($pageimgdata as $pageid => $filename) { $p = $this->pages->get($pageid); $PFM = new PagefilesManager($p); foreach($data as $entry) { $img = $PFM->getFile($filename); if($img) $img->removeVariations(); } $PFM = null; if($p != $this->page) $this->pages->uncache($p); // To clear up memory early in case there are a lot of pages }
  5. BitPoet

    Yes, it iterates the page's assets directory, checks every file if it is a variation of the current image and, if yes, recreates it with the constraints encoded in the variation's filename.
  6. BitPoet

    It's not hard to implement yourself. Create a template with a PHP file where you: Parse and sanitize all relevant information from the call (page id, filename, width, height, other options/actions) Retrieve the page with the given id Instantiate a PagefilesManager object with the page as the parameter Retrieve the image by calling getFile on the PagefilesManager Call size() on the image with necessary parameters/options Call $session->redirect() with the url of the object return by the site() call Here's a quick&dirty implementation:
  7. BitPoet

    @apeisa: this is just for FieldtypeComments and documented on the details tab for comments fields, where it can be used.
  8. BitPoet

    It is possible that the admin page was named differently than the default when PW was installed. In that case, you can determine the correct name (= path) from the entry in the "pages" table for the page with id 2.
  9. BitPoet

    Microsoft acquired GitHub last October. They likely need to present some growth figures for the first quarter to the board. So probably no catch (in the short run).
  10. Hi @DL7, thanks for the feedback. I'll try to find the time tomorrow to give it a spin on the latest PW version so I can hopefully reproduce the behavior.
  11. You could experiment with Pages::added too. This would also run the code when you add a new page through the API.
  12. BitPoet

    @benbyf, have you looked at the first link @szabesz posted?
  13. Adding pagination to your category template should be quite straight forward. There are step-by-step instructions and examples at https://processwire.com/docs/front-end/markup-pager-nav/
  14. The question is if the content is really the same. If it is, and the changes are just in the PHP templates, you could use PW's built-in multi-site support and (untested): Copy the PW installation to the second site's webroot Delete the "site/modules" directory and link it to the original site's modules directory Do the same for site/assets/files Do the same for the wire directory Delete the contents of the site/assets/cache and site/assets/sessions directories Edit site/config.php, set $config->sessionName to something unique from the first site (the default is "wire", so perhaps something like "wiresite2") and adapt $config->httpHosts to match your new site's hostname(s) All done. This assumes that both sites are hosted on the same server with the web server running as the same user. If that isn't the case, you will have to either adapt file system permissions, group memberships and umasks (same server, different users) or keep your own copies of wire, modules and files directories around and sync these from the first site (in that case, you best disallow admin access in the copy through .htaccess) If you want the copy to have some unique content, the task gets a bit harder, and you might have to use some kind of export/import mechanism or a feed like you wrote. But you could cover some unique content with individual templates that only have a matching PHP template on one of the sites, and there are ways to hook into Page::viewable and decide in PHP code (site/ready.php) whether certain pages can be viewed in the current site (e.g. if a page has an ancestor that hast the current hostname or a wildcard in a certain field).
  15. BitPoet

    Just create an individual template for that kind of page without a PHP template file.