Jump to content

Yannick Albert

Members
  • Posts

    58
  • Joined

  • Last visited

Posts posted by Yannick Albert

  1. One has to parse those comments blocks out of the html, recursively, identify/skip real comments, follow inheritance tree, protect against vuln xss foo etc... The parsing is currently done in WireMarkupRegions.php which has a lot hardcoded and html specific stuff, so it's hard to wrap around.

    If you really want this syntax, you should stick with an existing template engine like twig or mustache and replace the template tags with your custom comment-tag. Also consider FileCompilerModule...

    I personally use plates...

    • Like 1
  2. 23 hours ago, kongondo said:
    1. Example usage: Blog and Matrix modules. 

    If you link to GitHub, please use the commit-id (instead of branch-names). Otherwise, future editions could make those links pointless.

    1. Example usage: Blog and Matrix modules.

    Protip: To get the SHAified url on GitHub, go to any file you want to link to (e.g. https://github.com/kongondo/Blog/blob/master/ProcessBlog.module) and press Y (without anything, just y) on your keyboard.

    • Like 5
  3. After a quick research...

    Found this migration guide (PHP 7.0.x to PHP 7.1.x): http://php.net/manual/migration71.php

    Maybe this is somehow related to your issue:

    Dumb question: Have you tried to restart nginx and double checked that it runs with the correct php-cgi/php-fpm and latest mariadb/mysql?

    • Like 1
  4. Just found out that ProcessWire already handles the setWireAndDatabaseStuff in WireDatabasePDO::backups.

    So, instead of this:

    $backupPath = $config->paths->assets . 'backups/database/';
    $backupMeta = new WireDatabaseBackup($backupPath);
    $backupMeta->setWire($meta);
    $backupMeta->setDatabase($meta->database);
    $backupMeta->setDatabaseConfig($meta->config);
    $backupMetaFile = $backupMeta->backup(['description' => 'saludos your Cron']);

    ...it could be just this:

    $backupMeta = $meta->database->backups();
    $backupMetaFile = $backupMeta->backup(['description' => 'saludos your Cron']);

     

    • Like 1
  5. I think this should work (not tested):

    # Load media files from production server if they don't exist locally
    # http://rzen.net/serve-missing-media-production-apache-nginx/
    <IfModule mod_rewrite.c>
      RewriteEngine On
      RewriteCond %{REQUEST_FILENAME} !-f [NC]
      RewriteRule ^(.*\.(js|css|png|jpe?g|gif|ico)) http://example.com/$1 [NC,P,L]
    </IfModule>

    ...if this doesn't work for you, try php:

    /**
     * Load media files from production server if they don't exist locally
     *
     * https://processwire.com/talk/topic/5550-local-development-and-remote-assets/?p=54385
     * https://processwire.com/talk/topic/4127-can-assets-folder-be-moved-to-another-domainsubdomain/?p=50150
     */
    $wire->addHookAfter('Pagefile::url', function ($event) use($config) {
      $path = str_replace($config->urls->root, $config->paths->root, $event->return);
    
      if (!is_file($path)) {
        $event->return = str_replace($config->urls->root, 'http://example.com/', $event->return);
      }
    });
  6. On 11. August 2016 at 8:47 PM, LostKobrakai said:

    Everywhere else
    [...]

    With PW 3.0 and multi-instance this is the option to avoid.

    Great overview, Benjamin!

    Have you any reference on this or could you explain why we should avoid wire(). What's the best way to go, using $this?

  7. On 7.11.2012 at 9:33 PM, Soma said:

    Hack no good, tool better:

    
    foreach($templates as $t){
     if($t->name == "admin") continue;
     $t->slashUrls = 0;
     $t->save();
    }
     

    Done.

     

    Since 2.6.9 we can also take care of Page Numbers and URL Segments:

    foreach ($templates->find('name!=admin') as $t) {
      if ($t->allowPageNum != 0) $t->slashPageNum = 0;
      if ($t->urlSegments != 0) $t->slashUrlSegments = 0;
      if ($t->slashUrls != 0) $t->slashUrls = 0;
      $t->save();
    }

    https://processwire.com/api/ref/template/#pw-methods-URLs

    In addition, we could also move the conditions into the selector:

     

    • Like 1
  8. Does someone know how to match a single image field in connection with showIf? To be a bit more specific, there's an image-field with "Maximum files allowed" set to "1" and a checkbox-field which should be only visible if image.count!=0. Both fields exist on the same page and aren't wrapped in a PageTable or Repeater (But in a Fieldset, does it matter?)...

    All I tried did not work:

    cover!=''
    cover.url!=''
    cover.count=1
    cover.count>0
    cover.count!=0
    cover.filename!=''

    The fun-fact: InputfieldSelector could find all those pages containing empty image fields with the tested selectors above.

    Any ideas?

    BTW: PW 3.0.11

  9. I don't have that feeling. Anyone else had this experience?

    Nope, performance is fine, for me (iPhone 5s iOS 9 Safari, iMac 27" OSX 10.10.4 Chrome, Safari & Firefox)

     

    It's funny, this did happen to the client in her browser and it stopped after a couple of changes i did. I stress tested the site on some browsers and was never able to reproduce it. This happened to you on the iPhone?

    I can reproduce it... Just open your developer tools, take a look at the generated source and follow the steps explained above. You will see something like this, I am sure ;)

    post-1820-0-48213700-1436650703_thumb.pn

    post-1820-0-66445500-1436650702_thumb.pn

    • Like 1
  10. Looks great so far, except some things...

    It seems that there's something wrong with the replacement part of your ajax implementation. Go to at least two different pages and browse back, the content gets appended (also the slider component).

    Another point is user experience. If you want to provide a good/native feel, cache the scroll offsets and restore them on popstate. So, jump to the position where the user was, before he browse the history (via back/forward-buttons, history menu or any other way). replaceState is a good tool for this... Jörn Zaefferer talked about those topics

    (de) and has made a repo therefor https://github.com/jzaefferer/pitfalls-examples.

    Also, some more/different typography elements would be nice too...

    Btw: I'm on my couch with iPhone iOS 9 - mobile safari ;)

    • Like 3
×
×
  • Create New...