Jump to content

Chris-PW

Members
  • Posts

    13
  • Joined

  • Last visited

Posts posted by Chris-PW

  1. Hello,
    in ProcessWireUpgrade I only get the modules displayed but no longer the PW versions.

     

    I hope someone can help me.

    ProcessWire: 3.0.200
    PHP: 7.4.32
    ProcessWireUpgrade: 0.1.1
    ProcessWireUpgradeCheck: 0.0.9


    max_execution_time: 3600 (changeable)
    max_input_nesting_level: 64
    max_input_time: 60
    max_input_vars: 4000
    memory_limit: 512M
    post_max_size: 128M
    upload_max_filesize: 128M

  2. Hello Jurgen,
    sorry for the late reply.
    Unfortunately the same error comes again.

    I'd love to help you, but unfortunately my PHP OOP knowledge isn't good enough for that.

    I looked again and found this in the PW forum. Maybe that can help a bit:

    And this:

    https://processwire.com/blog/posts/processwire-3.0-alpha-2-and-2.6.22-rc1/#compiled-template-files

    And this:

     

    It works for you and sp1key on Windows XAMP and not on Mac-Mamp and Linux-Server. I would tap on a spelling problem with paths.
    Maybe a sanitizer changes a bit too much on a path....?

    Many greetings,
    Christian

  3. Hello,
    unfortunately the same error comes up. ?  But I think you are on the right path to the solution.

    (I downloaded your new version as a zip from GitHub and completely uninstalled the old one in PW first. Then unpacked the new one and renamed the folder according to your specifications. Then I reinstalled and activated it in PW…)

    I looked for it on the web, maybe this will help:

    https://dev.to/dechamp/php---how-to-fix-class--not-found-error-1gp9

     Upper and lower case seems to be a problem with the classes. Probably also on the Mac with file names and paths...

    Maybe you have another idea...

     

    Best regards
    Christian

  4. Hello Jurgen,
    Thank you for testing.
    But I get the exact same errors as before.
    It doesn't matter if I take the code template from you or just insert the relevant part.

    Then I tried PHP versions 7.2.34 - 8.0.8.
    From version 8 the error message is longer. See pictures.
    It runs under Mamp Pro on a Mac. But haven't had any problems so far.


    I think it has something to do with how you access paths with your module. (#1 on error message)
    Did you also use the latest PW Dev 3.0.199 version?
    Have you possibly made another setting that differs from the normal PW installation? Possibly in the config?

    Regards,
    Christian

    Bildschirmfoto 2022-05-12 um 10.46.35.png

    Bildschirmfoto 2022-05-12 um 10.46.44.png

  5. Hello @Juergen,
    Thank you for the quick reply and correction.?
    The installation errors are now gone.
     
    Unfortunately, the other problem remained.
    I've tried all variants to get it working to no avail.
    I use a quick clean PW install with the beginner theme.

    Standard profile (beginner version)

    The Processwire namespace is almost everywhere here, maybe that's why. Unfortunately, I have no practical experience with namespaces and PHP OOP knowledge is unfortunately only somewhat theoretical.
     
    Can you please test your module with this default base (Beginner Edition) under PW version: 3.0.199? At best, integrate exactly according to your instructions.

    I copied the two lines into the existing _init.php.
    Then I created a page with a template and as a template 1:1 yours Code examples integrated and tested one after the other. The same errors keep coming.

    Just an idea:
    Maybe it's also a problem with the names, because you use frontendforms in different CamelCase variants...?

    Many greetings,
    Christian

    Bildschirmfoto 2022-05-10 um 10.20.21.png

  6. Hello @Juergen,
    First of all thanks for the module. Unfortunately, I get 6 errors displayed during the installation.

    PHP Warning: ProcessWire\FrontendForms::ProcessWire\{closure}(): Argument #2 ($key) must be passed by reference, value given in .../pwclean/site/modules/FrontendForms/FrontendForms.module:409

    My system:
    MAMP, PHP 8.0.8
    PW-Version: 3.0.199
    FrontendForms-Version: 2.0.2

    Since there are only warnings, I tried to integrate it anyway.
    Unfortunately without success, because I get error messages here too.

    Error (in frontend):
    Class "FrontendForms\Alert"
    Not found
    Form.php 121
    File: .../pwclean/site/modules/FrontendForms/Formelements/Form.php:121

    This is how your example is integrated into the template (File: _init and the test Page Template form.php): 

    //_init.PHP
    <?php namespace ProcessWire;
    
    /**
     * Initialization file for template files 
     * 
     * This file is automatically included as a result of $config->prependTemplateFile
     * option specified in your /site/config.php. 
     * 
     * You can initialize anything you want to here. In the case of this beginner profile,
     * we are using it just to include another file with shared functions.
     *
     */
    
    include_once("./_func.php"); // include our shared functions
    
    $frontendforms = new FrontendForms();
    $frontendforms->setLang('de');
    
    // Ende init.php
    
    //*****************************************
    // (The test template):
    // form.php
    
    <?php 
    
    include('./_uk-head.php'); // include header markup 
    
    
    ?>
    
    
    
    <div class="uk-section ">
        <div class="uk-container uk-container-large">
    
    <?php    
        $form = new \FrontendForms\Form('contactform');
    
        $gender = new \FrontendForms\Select('gender');
        $gender->setLabel('Gender');
        $gender->addOption('Mister', 'Mister');
        $gender->addOption('Miss', 'Miss');
        $form->add($gender);
    
        $surname = new \FrontendForms\InputText('surname');
        $surname->setLabel('Surname');
        $surname->setRule('required');
        $form->add($surname);
    
        $name = new \FrontendForms\InputText('lastname');
        $name->setLabel('Last Name');
        $name->setRule('required');
        $form->add($name);
    
        $email = new \FrontendForms\InputText('email');
        $email->setLabel('E-Mail');
        $email->setRule('required');
        $email->setRule('email');
        $form->add($email);
    
        $subject = new \FrontendForms\InputText('subject');
        $subject->setLabel('Subject');
        $subject->setRule('required');
        $form->add($subject);
    
        $message = new \FrontendForms\Textarea('message');
        $message->setLabel('Message');
        $message->setRule('required');
        $form->add($message);
    
        $privacy = new \FrontendForms\InputCheckbox('privacy');
        $privacy->setLabel('I accept the privacy policy');
        $privacy->setRule('required')->setCustomMessage('You have to accept our privacy policy');
        $form->add($privacy);
    
        $button = new \FrontendForms\Button('submit');
        $button->setAttribute('value', 'Send');
        $form->add($button);
    
        if($form->isValid()){
    
        print_r($form->getValues());
        // do what you want
    
        }
    
        // render the form
        echo $form->render();
    
    
    ?>
        </div>
    </div>
    
    
    <?php include('./_uk-foot.php'); // include footer markup ?>
    
    //Ende form.php

    Somehow there seems to be a problem with the "namespace" or something similar. Maybe I misunderstood something... This is the integrated code from your example that leads to the errors.

    Since your module reads as a really nice solution, I'd love to use it. Can you please help. Thanks.

    Christian

  7. On 9/10/2021 at 2:18 PM, Zeka said:

    Hi @millipedia.

    Nice write-up.

    How did you get forcing of PDF downloading? 
    Recently I was working on the project where they had a large amount of science articles in PDFs and they wanted to force downloading of these files with settings custom file names (user provided).
    There is the code that I use, but for some reason some of PDFs files still open 'inline' in Chrome. 

    $wire->addHook('/download/{pageid}/{basename}/', function ($event) {
      $page = $this->wire()->pages->get($event->pageid);
    
      if ($page->id) {
        $file = $page->filesManager->getFile($event->basename);
        $filename = $file->description ? $file->description . '.' . $file->ext : $file->basename;
    
        wireSendFile($file->filename, [
          'downloadFilename' => $filename,
          'forceDownload'    => true,
          'exit'             => true,
        ]);
      } else {
        wire404();
      }
    });

     

    Hello, I'm not sure if that's what you mean. But you can specify a download of files directly as an attribute in the HTML.

     

    Use the a download attribute:

     

    <a href="/OldName.pdf" download="NewName"> Download PDF</a>

     

    (The value "Filename" is optional.)

    • Like 1
×
×
  • Create New...