Jump to content

jrtderonde

Members
  • Posts

    35
  • Joined

  • Last visited

Posts posted by jrtderonde

  1. Hey,

    I recently started working at a new agency where I'll be developing mostly back-end projects. One of my colleagues has introduced me to GraphQL. We're currently using Wordpress in combination with ACF but as I was google-ing I stumbled upon a post in which I saw a GraphQL module for PW, awesome!

    I think the agency wants to start moving towards a workflow in which we will use a CMS "headless". We build up pages using flexible content (or "Repeater Matrix") and I was wondering if anyone has any experience in using the pro matrix in combination with either graphql or rest api. Ultimately we would be looking to implement GraphQL as it's so fast and dynamic.

     

    Looking forward to hearing from your experiences ?

  2. Ok, but that's why I'm trying to prevent with the hash as $page->name. I'm using the ID of the customer combined with a timestamp to generate a md5 hash that's "unique". (See the code, I'm pretty sure it should work). 

    Also, the next entry in the array has a complete different customer id. So it should be "impossible" to be duplicated.

    I'm using this code within a pageSaveHook (module). Could this be a problem? Furthermore, the array counts 11000+ entries, could it be that this is a problem? The platform is hosted on a stable and fast VPS and I cranked up the PHP execution time to 10 minutes, so it shouldn't cause any serious trouble.

  3. Hey,

    I'm working around a module that adds pages in my ProcessWire installation. The pages are added based on a JSON array that will be imported through a page save. Everything works fine except for when the pages are added. I get the following error

    Integrity constraint violation: 1062 Duplicate entry '3e215ecd6774fd99c2b0eb5cadf36a07-1269' for key 'name_parent_id'

    I'm using the following code/loop to generate the pages.

    // Loop through the files
    foreach ($p->importFile as $file)
    {
        // Set the file location
        $name = $file->data["basename"];
        $path = $p->importFile->path;
        $location = $path . $name;
    
        // Get the file
        $json = file_get_contents($location);
        $json = json_decode($json);
    
        // Loop through the rows of the import
        foreach ($json->ttEntityDelAddrLink as $client)
        {
            // Create new page
            $new = new Page();
    
            // Create unique hash
            $unique = md5(date("Y-m-d H:i:s") . "-" . $client->CustomerCode);
    
            // Set some variables for the new page
            $new->setOutputFormatting(false);
            $new->template = "_client";
            $new->parent = $p;
    
            // Create hash
            $new->title = $client->DelAddressName;
            $new->name = $unique;
    
            // Page specific fields
            $new->company = $client->DelAddressName;
            $new->companyId = $client->CustomerCode;
            $new->city = $client->DelAddressCity;
            $new->address = $client->DelAddressStreet;
            $new->postcode = $client->DelAddressZipCode;
            $new->country = $countries[$client->DelAddressCountryCode];
    
            // Save the page
            $new->save();
        }
    
        // Exit for debugging
        exit;
    }


    Does anybody know what's wrong?

  4. Hey,

    I was wondering if there's a way to add more fields to specify when creating a new page. At the moment, the only two fields are required for creating a new page. 

    • Title
    • Name (Automated)

    I've configured processwire so that the chosen page to create is limited to one template. Guess this would make the process to achieve the above a bit easier.

     

    Regards,

  5. Thank you for the response Horst.

    I looked into the documentation, yet I didn't find anything concerning sharpening of images. That's why I came here to ask. I will mask this as solved. But could you please be so kind to link me the page in which the sharpening topic is covered? Thank you in advance.

    Regards,

    Jim

    • Like 1
  6. Hey,

    I was wondering if there is an alternative to the default Processwire ImageSizer. Although it comes in really, really handy (I have actually never used any Content Management Framework that comes with a default Resize module) I am not quite content when it comes to resizing large images.

    Check this image:

    http://imgur.com/KNS9VWB

    You can clearly see a difference in sharpness of both images, after resizing the image comes out a bit blurry (Yes, quality is on 100).  Has anybody else encountered this? If so, is there any good alternative (in form of a Module). 

    Much love to anyone that's willing to help <3

  7. There were two problems in my case. First problem was a conflict between a module I use called AIOM (All-In-One Minifier). The AIOM module caused an error just before the Page Protector module was triggered. When I enabled the debug logging I found out about this bug as there was no exception thrown. 

    The second error was the way I structured the templates; I used one template file called main.php which automatically includes a controller and a view based on the template name. As there was no real template loaded, it created a blank error page.

    Although the chance is rare that someone will ever stumble upon the same errors as I did, I hope this might help someone out - someday.

  8. Glad to hear - if you have a minute, it would be great if you could explain what was wrong so others might learn. 

    Are you saying that despite the homepage being protected, guest visitors are having full access to the homepage?

    Is this your script that is redirecting to the homepage, or the PP module? Remember that the login form is injected into the currently viewed page - it is not a separate page. 

    I fixed it by creating an actual login page (including template) to redirect to.

  9. @adrian, thanks for your input! I managed to debug and I got the module to work except for one little thingy.

    I checked "protect entire site" - yet when I destroy the user's session and direct them to the homepage. I found that when I redirect the user, the login template isn't popping up. Obviously this could be because the script redirects to the homepage. Is there a way to redirect the user to the login template?

    Thanks for your time, it helped me an awefull lot!

  10. Thanks for your reply. My settings are here: http://imgur.com/xjfRhvM.

    The code I am using for the login template are below:

    <?php
    
        // Variables
        $css = Wire("config")->urls->templates .  "assets/css/styles.css";
        $favicon = Wire("config")->urls->templates . "assets/img/favicons/favicon.ico";
    
    ?>
    <!DOCTYPE html>
        <head>
            <title>Login</title>
            <meta charset='utf-8' />
            <link rel='stylesheet' href='$css' type='text/css' />
            <link rel='shortcut icon' href='$favicon'>
        </head>
        <body class='login'>
            <div class='full-size'>
                <div class='container'>
                    <div class='protected-mode-container'>
                        <div class='top'>
                            <h1>Inloggen</h1>
                        </div>
                        <form class='protectedModeForm' action='./' method='post'>
                                <p>Lorem ipsum dolor sit amet, con sectetuer adipiscing elit. Aenean commodo eupio ligula eget dolor.</p>
                                <input type='text' class='input' name='username' placeholder='Naam' value='' />
                                <input type='password' class='input' name='pass' placeholder='Wachtwoord' value='' />
                                <button type='submit' class='button' name='login'>Login</button>
                        </form>
                    </div>
                </div>
            </div>
        </body>
    </html>
    

    It's just really weird that even if I destroy all sessions, it won't let me visit this login page.

    Hope we can work this out, thanks for your time  O0


    Don't mind the non-echoed variables (stylesheets).

×
×
  • Create New...