I Built An Upfront Template Builder

Well… almost :slight_smile:

I threw together some code that uses Upfronts’ inbuilt functions to turn the Json object stored in the database to the PHP code you need to add to a custom layout (it’s not pretty but it seems to work so I thought I’d share it).

I haven’t got round to messing about with global properties and styles and such yet but if I write the helper code I’ll add it online also.


Warning: This assumes you generally know what you are doing already. Use at your own risk.

1. Make page in upfront and save it

2. In plugin add the page name as it appears in the databse minus the storage key (i.e. storage key is something like “Spririt” so it will be like “single-page-123” that you enter)

3. Select the regions that you want to be generated into php and hit export.

4. Paste the code into your layout file.

Here is the plugin: https://github.com/GuerrillaCoder/Upfront-Template-Builder

  • Mike
    • The Bug Hunter

    Hold off on trying it for a day or two. The Upfront_Virtual_Region method isn’t setting the modules and wrappers when done like this. To make it keep the layout from the GUI I need to translate the wrappers back to API settings so it can make them into wrappers again.

    That seems a little silly so I am experimenting with ways to get around it without having to extend the class or restructure the data in the arrays. I’ll post back when I get it worked out.

  • Alex
    • Design Lord, Child of Thor

    Does it work with Upfront 1.3? I am getting warnings:

    Warning: Invalid argument supplied for foreach() in upfront-template-builder.php on line 74

    Warning: Invalid argument supplied for foreach() in upfront-template-builder.php on line 88

    Thank you,


  • Mike
    • The Bug Hunter

    Hi Alex,

    I am not sure. I stopped using Upfront several months ago as the way it stores data was just causing me too many issues.

    This was just a quick hack as James Farmer went on record guaranteeing that the template feature would be released before 2016. If I had known that would not materialize I would have spent some more time on it but the real problem is that the Upfront development team have a Json wrapper that they didn’t (don’t?) include in the released code so working on it is just a pain in the butt.

    As it’s just a quick hack I didn’t put any validation on it so it might be you haven’t put in the right key or haven’t selected a region to export (the check boxes at bottom).

  • Alex
    • Design Lord, Child of Thor

    Hi Mike,

    Thank you for the clarification!

    You’re right, the way Upfront stores data does cause a number of issues.

    I quite like the Fusion Page Builder solution, which gives you plenty of functionality while allowing you to switch between the Visual editor and Fusion editor if need be. Having a solution like this, however, requires the proper parser and a lexer, which takes longer to implement than the current quick Upfront solution.

  • Mike
    • The Bug Hunter

    I am using Beaver Builder now. They separate markup and content which is good. Upfront separates some of this but for lots of components it doesn’t do it so when you change template you lose your content which is ridiculous. To make content bound to template is a bad design choice and makes Upfront for me non-viable.

    Also Upfront stores data in the database with unescaped spaces. This causes wordpress import/export to break which was the final tipping point that stopped me from using it.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.