Jump to content

Processwire tricks and tips


benbyf
 Share

Recommended Posts

Looking to write a tricks and tips article, anyone got anything which is SUPER useful for Processwire users which sits outside of installation and general usage and structure? Maybe things you wish you were told, or little tricks to get around restrictions or issues.

  • Like 2
Link to comment
Share on other sites

Hi @benbyf I cannot come up with something that has not been addressed in the forums in some way or another, there is so much buried here that it is probably impossible to decide what should be highlighted more than others.
It might not fit your current needs, but what I would like to see in a more concise/tutorial like manner is implementing complete frontend user features from scratch. Well, maybe not from scratch, you could use UIkit 3 to do the design stuff, but other than that only pure PW could be used, even without the backend's form API. Something like this one turned into a complete tutorial:

Such a tutorial would not only provide on solution to the long standing "how to do frontend users" dilemma, but it would also be a great example of implementing forms, sending emails, etc..

  • Like 2
Link to comment
Share on other sites

21 hours ago, szabesz said:

Hi @benbyf I cannot come up with something that has not been addressed in the forums in some way or another, there is so much buried here that it is probably impossible to decide what should be highlighted more than others.
It might not fit your current needs, but what I would like to see in a more concise/tutorial like manner is implementing complete frontend user features from scratch. Well, maybe not from scratch, you could use UIkit 3 to do the design stuff, but other than that only pure PW could be used, even without the backend's form API. Something like this one turned into a complete tutorial:

Such a tutorial would not only provide on solution to the long standing "how to do frontend users" dilemma, but it would also be a great example of implementing forms, sending emails, etc..

might address this somewhat with the revamped subscribers module which im going to be working on soon... what did you want to see? I though of putting together a site profile job site as an example of how to use it in production.

  • Like 3
Link to comment
Share on other sites

3 minutes ago, benbyf said:

might address this somewhat with the revamped subscribers module which im going to be working on soon... what did you want to see? I though of putting together a site profile job site as an example of how to use it in production.

This sounds great to me! Tricks and tips can be useful, but if you have the time, a tutorial can be more helpful, but obviously requires more time. The topic of "newsletters and frontend users" is worth the effort, I think. I'm thinking of targeting somewhat experienced developers new to ProcessWire, so you should not have to delve into all the details, but provide working example code with comments and some explanation, just like you did in the case of your Beginner’s modules tutorial, but this time it would be more lengthy I think.

  • Like 2
Link to comment
Share on other sites

On 4/4/2017 at 10:17 AM, szabesz said:

This sounds great to me! Tricks and tips can be useful, but if you have the time, a tutorial can be more helpful, but obviously requires more time. The topic of "newsletters and frontend users" is worth the effort, I think. I'm thinking of targeting somewhat experienced developers new to ProcessWire, so you should not have to delve into all the details, but provide working example code with comments and some explanation, just like you did in the case of your Beginner’s modules tutorial, but this time it would be more lengthy I think.

 
 
 
 

For a project I've posted yesterday I built a basic module to subscribe users to a Sendy installation. I love Sendy and my client too as we use it to send lots of emails using Amazon SES costing almost nothing at all. Do guys think that's worth to post about? It's very basic now, it doesn't use Sendy's API at all, it just send the data using POST to subscribe the users to different lists. 

Edited by Sérgio
grammar
  • Like 4
Link to comment
Share on other sites

  • 1 year later...
On 4/5/2017 at 11:19 AM, Sergio said:

For a project I've posted yesterday I built a basic module to subscribe users to a Sendy installation. I love Sendy and my client too as we use it to send lots of emails using Amazon SES costing almost nothing at all. Do guys think that's worth to post about? It's very basic now, it doesn't use Sendy's API at all, it just send the data using POST to subscribe the users to different lists. 

I added the source code on this post: 

 

  • Like 2
Link to comment
Share on other sites

Over the years, I accumulated so many custom API scripts, that I have decided at some point to simply include a special template in my PW boilerplate that holds all these utility / "batch-operation" API scripts in one place.

In the template settings, I allow URL segments, and make sure access is for superusers only.

This "API-scripts" template has (for better maintainability / readability) a simple switch/case that loads a certain .php file via include:

Spoiler

<?php namespace ProcessWire;

if( !$user->isSuperuser() ) {
    return $this->halt();
}

switch ($input->urlSegment1) {

    case 'set-live-urls':
        include_once('actions/set-live-urls.php');
        break;

    case 'cleanup-client-names':
        include_once('actions/cleanup-client-names.php');
        break;

    case 'client-names':
        include_once('actions/client-names.php');
        break;

    case 'field-edit':
        include_once('actions/field-edit.php');
        break;

    case 'wp':
        include_once('actions/wp.php');
        break;

    case 'dexter':
        include_once('actions/dexter.php');
        break;

    case 'fields':
        include_once('actions/template-and-field-listing.php');
        break;
        
    case 'add-industry-from-vertec':
        include_once('actions/add-industry-according-to-vertec-codes.php');
        break;
        
    case 'fieldsets':
        include_once('actions/getFieldsetOf.php');
        break;
        
    case 'handson-table':
        include_once('actions/handson-table.php');
        break;
        
    case 'image-tags':
        include_once('actions/image-tags.php');
        break;
        
    case 'mapping':
        include_once('actions/mapping.php');
        break;
        
    case 'page-lock':
        include_once('actions/page-lock.php');
        break;
        
    case 'create-cms-partners':
        include_once('actions/pages-create-cms-partners.php');
        break;
        
    case 'reset':
        include_once('actions/reset.php');
        break;
        
    case 'users-create':
        include_once('actions/users-create.php');
        break;
        
    case 'users-edit':
        include_once('users-edit.php');
        break;
        
    case 'users-listing':
        include_once('users-listing.php');
        break;
        
    case 'vertec-check':
        include_once('vertec-check.php');
        break;

    default:
        break;
}

return $this->halt();

So, if e.g. I need a quick listing / overview of all fields that a certain template has, I go to: mysite.com/api-scripts/fields - then I go back and lock the template again = comment the first few lines for security reasons (one can never be too paranoid...).

For me, these are big time-savers, because even if you have to modify the included scripts for the current project, at least I don't have to search for these scripts over and over again and guess "where have I been using something similar the last time?"

tl;dr: It's like having the whole PW-recipes site (and more) always at your fingertips ?

 

 

  • Like 6
Link to comment
Share on other sites

4 minutes ago, bernhard said:

@dragan do you know adrians admin actions module?

Sure. I have that installed as well. But very often, I need to do stuff that's not possible with that module, or simply easier to do writing a few lines of code myself. 

  • Like 3
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...