Jump to content

Site patterns


rajo
 Share

Recommended Posts

Hi,

Has this community looked at site patterns and created some reusable getting-started models?

I know PW is the malleable backend crafters use to roll their own brilliance, but no doubt, by now, some patterns have emerged for the best practices of how to layout the DB, what templates go with what pages, what fields go where, etc, when you're contemplating implementing a News site, vs. a Gallery, vs. a Corporate site, etc.  

If indeed such "best practices" have been documented, maybe the next step would be packaging those in an installable getting-going thang.

I haven't used pw for a couple of years now. I'm currently looking at creating a site that's somewhat like a News site, with prominent articles, archives, some media.  But I'm balking at having to roll the whole thing myself from scratch, versus getting a leg up with Bob's News Site Template, a distilled getting-started framework.

There's barebones, which gives the most freedom, then there's flesh and bones meant to be extended. I'd think that as PW is maturing, there's enough repeatable history that something could be packaged.

Are there such artifacts in this community?  Or would that betray PW's anti-WP origins?

Of course, these need not be free, as long as the "store" allows you to really grok the package before buying.

Thanks.

 

Edited by rajo
typo
Link to comment
Share on other sites

I built ProcessWirePageLists a long time ago - it works with Migrator and lets you install the fields and templates (and in some cases pages) for getting started quickly.

https://github.com/adrianbj/ProcessWirePageLists

The `person.json` file is probably the most relevant to the question you are asking. You could easily build one-click installs of templates/files all sorts of things, like a blog, hotel booking field/templates, news articles, image gallery, ecommerce - whatever really. Maybe I should commit some more myself, but my original plan was to get user contributions to that repo.

This is how you "install" them. They are pulled in at runtime directly from Github, so new ones are always available.

image.png.8726dcf1024c532bf2468e6bdb366539.png

 

This is what the JSON looks like for "person":

{

  • "templates":[
    1. {
      • "template":"person",
      • "data":{
        • "useRoles":0,
        • "childrenTemplatesID":0,
        • "sortfield":"",
        • "noChildren":"",
        • "noParents":"",
        • "childTemplates":[ ],
        • "parentTemplates":[ ],
        • "allowPageNum":0,
        • "allowChangeUser":0,
        • "redirectLogin":0,
        • "urlSegments":0,
        • "https":0,
        • "slashUrls":1,
        • "altFilename":"",
        • "guestSearchable":0,
        • "pageClass":"",
        • "pageLabelField":"",
        • "noGlobal":0,
        • "noMove":0,
        • "noTrash":0,
        • "noSettings":0,
        • "noChangeTemplate":0,
        • "noShortcut":0,
        • "noUnpublish":0,
        • "nameContentTab":0,
        • "noCacheGetVars":"",
        • "noCachePostVars":"",
        • "useCacheForUsers":0,
        • "cacheExpire":0,
        • "cacheExpirePages":[ ],
        • "label":"",
        • "tags":""
        }
      }
    ],
  • "fields":[
    1. {
      • "name":"title",
      • "label":"Title",
      • "description":null,
      • "template":"person",
      • "flags":13,
      • "type":"FieldtypePageTitle",
      • "data":{
        • "required":1,
        • "textformatters":[
          1. null
          ],
        • "size":0,
        • "maxlength":255
        }
      },
    2. {
      • "name":"first_name",
      • "label":"First Name",
      • "description":null,
      • "template":"person",
      • "flags":0,
      • "type":"FieldtypeText",
      • "data":{
        • "columnWidth":50,
        • "size":0,
        • "maxlength":2048
        }
      },
    3. {
      • "name":"last_name",
      • "label":"Last Name",
      • "description":null,
      • "template":"person",
      • "flags":0,
      • "type":"FieldtypeText",
      • "data":{
        • "columnWidth":50,
        • "size":0,
        • "maxlength":2048
        }
      },
    4. {
      • "name":"portrait",
      • "label":"Portrait",
      • "description":null,
      • "template":"person",
      • "flags":0,
      • "type":"FieldtypeImage",
      • "data":{
        • "extensions":"gif jpg jpeg png",
        • "maxFiles":1,
        • "inputfieldClass":"InputfieldImage",
        • "descriptionRows":1,
        • "adminThumbs":1,
        • "defaultGrid":0,
        • "fileSchema":2
        }
      },
    5. {
      • "name":"position",
      • "label":"Position",
      • "description":null,
      • "template":"person",
      • "flags":0,
      • "type":"FieldtypeText",
      • "data":{
        • "columnWidth":50,
        • "size":0,
        • "maxlength":2048
        }
      },
    6. {
      • "name":"department",
      • "label":"Department",
      • "description":null,
      • "template":"person",
      • "flags":0,
      • "type":"FieldtypeText",
      • "data":{
        • "columnWidth":50,
        • "size":0,
        • "maxlength":2048
        }
      },
    7. {
      • "name":"email",
      • "label":"E-Mail Address",
      • "description":null,
      • "template":"person",
      • "flags":9,
      • "type":"FieldtypeEmail",
      • "data":{
        • "size":70,
        • "maxlength":255,
        • "columnWidth":50
        }
      },
    8. {
      • "name":"website",
      • "label":"Web site",
      • "description":null,
      • "template":"person",
      • "flags":0,
      • "type":"FieldtypeURL",
      • "data":{
        • "noRelative":0,
        • "addRoot":0,
        • "columnWidth":50,
        • "size":0,
        • "maxlength":1024
        }
      },
    9. {
      • "name":"phone",
      • "label":"Phone",
      • "description":null,
      • "template":"person",
      • "flags":0,
      • "type":"FieldtypeText",
      • "data":{
        • "columnWidth":33,
        • "size":0,
        • "maxlength":2048
        }
      },
    10. {
      • "name":"mobile",
      • "label":"Mobile Phone",
      • "description":null,
      • "template":"person",
      • "flags":0,
      • "type":"FieldtypeText",
      • "data":{
        • "columnWidth":34,
        • "size":0,
        • "maxlength":2048
        }
      },
    11. {
      • "name":"fax",
      • "label":"Fax",
      • "description":null,
      • "template":"person",
      • "flags":0,
      • "type":"FieldtypeText",
      • "data":{
        • "columnWidth":33,
        • "size":0,
        • "maxlength":2048
        }
      },
    12. {
      • "name":"po_box",
      • "label":"PO Box",
      • "description":null,
      • "template":"person",
      • "flags":0,
      • "type":"FieldtypeText",
      • "data":{
        • "columnWidth":50,
        • "size":0,
        • "maxlength":2048
        }
      },
    13. {
      • "name":"address_1",
      • "label":"Address",
      • "description":null,
      • "template":"person",
      • "flags":0,
      • "type":"FieldtypeText",
      • "data":{
        • "columnWidth":50,
        • "size":0,
        • "maxlength":2048
        }
      },
    14. {
      • "name":"address_2",
      • "label":"Address",
      • "description":null,
      • "template":"person",
      • "flags":0,
      • "type":"FieldtypeText",
      • "data":{
        • "size":0,
        • "maxlength":2048
        }
      },
    15. {
      • "name":"city",
      • "label":"City",
      • "description":null,
      • "template":"person",
      • "flags":0,
      • "type":"FieldtypeText",
      • "data":{
        • "columnWidth":33,
        • "size":0,
        • "maxlength":2048
        }
      },
    16. {
      • "name":"state",
      • "label":"State",
      • "description":null,
      • "template":"person",
      • "flags":0,
      • "type":"FieldtypeText",
      • "data":{
        • "columnWidth":34,
        • "size":0,
        • "maxlength":2048
        }
      },
    17. {
      • "name":"country",
      • "label":"Country",
      • "description":null,
      • "template":"person",
      • "flags":0,
      • "type":"FieldtypeText",
      • "data":{
        • "columnWidth":33,
        • "size":0,
        • "maxlength":2048
        }
      },
    18. {
      • "name":"skype",
      • "label":"Skype",
      • "description":null,
      • "template":"person",
      • "flags":0,
      • "type":"FieldtypeText",
      • "data":{
        • "columnWidth":33,
        • "size":0,
        • "maxlength":2048
        }
      },
    19. {
      • "name":"twitter",
      • "label":"Twitter",
      • "description":null,
      • "template":"person",
      • "flags":0,
      • "type":"FieldtypeURL",
      • "data":{
        • "noRelative":0,
        • "addRoot":0,
        • "columnWidth":34,
        • "size":0,
        • "maxlength":1024
        }
      },
    20. {
      • "name":"facebook",
      • "label":"Facebook",
      • "description":null,
      • "template":"person",
      • "flags":0,
      • "type":"FieldtypeURL",
      • "data":{
        • "noRelative":0,
        • "addRoot":0,
        • "columnWidth":33,
        • "size":0,
        • "maxlength":1024
        }
      }
    ]

}

  • Like 6
Link to comment
Share on other sites

p.s. I'm finding my bearings around here again. I think "Site Profiles" represent what I'm talking about, either in part or wholly.  I'll go learn there also.  I must say, I couldn't find a definition of "Profile" in the docs, I didn't know what that meant at large.

https://processwire.com/  promotes the trees but doesn't say much about the forest and its varied on-boarding trails.

 

  • Like 1
Link to comment
Share on other sites

2 hours ago, rajo said:

I think "Site Profiles" represent what I'm talking about, either in part or wholly.

Yeah, Site Profiles are nice, but what I like about my poorly named "Page Lists" is that they can be applied one-by-one as components as needed and also added to a site after initial PW install.

I'd really like to build these out if we can get some community contributions.

  • Like 2
Link to comment
Share on other sites

I'd really like to build these out if we can get some community contributions.

Gotcha. I look forward to exploring that space over the coming weeks.  This is for a volunteer project that has nothing to do w/ my day job, hence my wanting some prefabs if possible.  I like the component-based approach you're describing.  To be continued...

Edited by rajo
typo
  • Like 1
Link to comment
Share on other sites

If there is some renewed interest, I was thinking that it might also be a good if I extended the "Shared JSON Packages" import option in Migrator to also supportt zip packages which can then include template/css/js files and assets/files. Anyway, just throwing it out there as an option to see if there is any interest.

  • Like 2
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...