Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Posts posted by dragan

  1. @bernhard Thanks for the hints. I didn't notice I was uploading .otf files instead of .ttf - my 2nd facepalm moment yesterday...

    As to the other issue I mentioned: I found out it's not related to RockPDF at all. I got some really weird issues with render() / wireRenderFile() - but only when I ran my code inside Tracy console. In a regular template everything works as expected. The issue was with matrix repeaters that are called with $child->render('offer_matrix') inside the template, where I use field template files* - suddenly PW wouldn't find these anymore.

    * site/templates/fields/matrix.php

  2. Maybe a directory traversal attack (to install backdoors or whatnot). I would immediately contact the hosting company, and also check for suspicious files. Lock down your forms, or any other potential areas that allow user-input.

    • Like 3
  3. Another issue: If I use wireRenderFile(), I get this fatal error:


    Exception: Invalid output file location or specified file does not exist. on line: 518 in /home/foo/www/dev.foobar/wire/modules/PageRender.module

    This used to work just fine with the previous version (v.7x), and the assets/file/ folder definitely exists.

  4. Yeah... using inline SVGs works just fine... until you want to style fills or strokes via CSS.

    I have updated rockPDF just now, and noticed that there's something buggy with using custom fonts.


    Exception: Cannot find TTF TrueType font file "Inter-Regular.ttf" in configured font directories. on line: 33 in /home/foo/www/dev.foo/site/modules/RockPdf/vendor/mpdf/mpdf/src/Fonts/FontFileFinder.php

    I have the fonts both in site/templates/fonts/ as well as in site/assets/RockPDF/fonts/. I have now also placed them in site/modules/RockPdf/vendor/mpdf/mpdf/ttfonts, cleared modules cache, but the error persists.

    I've looked into the module code, and presumably somewhere here the paths are defined:

      public function init($options = []) {
        // make sure the assets folder exists
        $this->wire->files->mkdir($this->wire->config->paths->assets . $this->className . '/fonts', true);
      public function settings($options = []) {
        // merge defaults
        $defaults = [
          'tempDir' => $this->wire->files->tempDir('RockPdf'),
          'fontDir' => [
            __DIR__ . '/vendor/mpdf/mpdf/ttfonts',
            $this->wire->config->paths->assets . $this->className . '/fonts',
        $options = array_merge($defaults, $options);

    Any clues how to fix this?

  5. @cosmicsafari Well, you could take a look at the BCE module...

    Did you look at server logs? Did you also try with a very small CSV file - maybe it's not the size of the files, or the time it takes to process everything, but some stumbling blocks in your code ?

    I would first try it with adding output formatting set to false, and then also use sanitizers (you can never trust user input), or at least trim(). I also noticed this line

    $p->name = $name.'('.$lat.','.$lng.')';

    which doesn't look OK. PW page names can't have special characters like (). Use the page-name $sanitizer and get rid of the () (or any other non-allowed characters).

    • Like 1
  6. 35 minutes ago, Anders said:

    by reading it off the post-it note I so conveniently have on my screen

    yeah well... no matter what system you use, that's a bad idea.

    37 minutes ago, Anders said:
    • Anything more? Any other modules or settings to look out for?

    Tracy Debugger can wreak havoc if used by non-trusted users (terminal, Adminer, console etc.). But you don't want to remove and install it again each time you log in as legitimate superuser, do you?

  7. @hollyvalero

    I tried it as well (hook is also in site/ready.php), and everything works just fine. Just copy-and-pasted the hook, and used the list example, and adjusted the selector. It even works within a partial I load via include_once() and cache the output with MarkupCache 🙂

    Do you run an ancient PHP version, by any chance? See Ryan's note about PHP < 5.3

    Also, did you find any hints with Tracy Debugger?

  8. @Marco Ro If you would draw a little sketch, and show exactly what you want to do, and how it's supposed to look like visually (it's still not clear to me from your description), maybe there is a way with CSS only. And perhaps also show what it looks out now, out of the box, for comparison.

    e.g. if all you want is to place the label on the left, and the input on the right, you could do it easily with flexbox: https://codepen.io/dragan1700/pen/JjdRYVE

  9. I agree too that this should be added to the styleguide, and I also configured my IDE to strip trailing whitespace on save.

    However, if we're talking about diff tools, it's just as easy to configure them to ignore whitespace (and even empty lines).



    Git has the option --ignore-whitespace you can use.

    VSCode: File => Preferences => Settings => Diff Editor => Ignore Trim Whitespace.

    • Like 2
  10. @wesp

    Well, that ain't so easy. If you wanted to make it behave like that - and make sure you don't break user's back-button in the process, and make sure people actually scroll to the section if they share/bookmark such a pseudo-link - you should use an SPA framework like Vue instead, where you have such custom routing functionality already built-in.

    otoh, it's quite easy to hide / remove the #section1 completely from the location bar - but that's not what you're after.

    • Like 2
  11. @wesp You don't need the Functions API for the functionality you asked for - it's just the syntax Zeka used that requires it, e.g. pages() instead of $pages etc.

    I have tried this combination here, and it works fine:

    // at the very top of home.php
    if ($input->urlSegment1) {
        $pagename = $input->urlSegment1;
        $match = $pages->findOne("template=article, name=$pagename");
        if (!$match->id) {
            throw new Wire404Exception();
        echo $match->render();
        return $this->halt();
    // site/ready.php
    // taken from this great case study: https://processwire.com/talk/topic/3987-cmscritic-development-case-study/
    wire()->addHookBefore('Page::path', function($event) {
        $page = $event->object;
        if($page->template == 'article') {
            $event->replace = true;
            $event->return = "/$page->name/";

    If you copy-and-paste, pls note that my template is called 'article', not 'article-page' 🙂

    Attached also the home template URL segment settings.

    Screenshot_2020-02-13 Edit Template Home (home) • pwbig test.png

    • Like 1
    • Thanks 1
  • Create New...