Jump to content

WireThemes


Nico Knoll

Recommended Posts

Like I mentioned in another topic I'm working on a theming system for Processwire. Today I finished a huge step in the right direction: A theme switcher.

How does it work

It's really easy. Frontend Themes are modules, (I added two testing Themes to the attachment), which only contain the module information (version, author, name, ...). They are based on a module called "WireThemes" which is included, too. WireThemes is the main controlling class. It rewrites the path of "$config->paths->templates" and "$config->urls->templates" which afterwards pointing to the folder of your Theme and contains the installing and uninstalling methods.

What I'm still working on

ProcessWire's great strength - but in case of theming a big complication - is that you have to/can create fields by yourself. So it's hard to create a theme which fit's on every system. That's why I'm still brainstorming how to make this easier. Possible solutions I see at the moment are: 

  • Creating a site profile with the most used fields
  • Creating a json file for ProcessMigrator
  • Hoping that the 2.5 default site profile includes the most used fields so I wouldn't have to change something
  • ...

Please try it and tell me about any problems. And if you have additional ideas this is the right place to write about them.

Download: https://github.com/NicoKnoll/WireThemes

  • Like 14
Link to comment
Share on other sites

Hi Nico, this is a very interesting development and perfect for a particular use case I have in mind right now. Your solution is very simple and elegant so far.

I see your problem with regards to ProcessWire's flexibility and I think the ProcessMigrator json file would be the best approach. How possible would it be for each theme module to have its own ProcessMigrator json file that could be used (as an optional step) to import fields used in the template? In this scenario you would install a particular theme module and then decide on whether you wanted to also install its field sets that guarantee a workable setup (or a bit of a blank slate).

Using a system like this would enable theme authors to create truly packageable themes whereby they can create themes for specific use cases and be able to guarantee that the fields are available in the system. The difficulty would obviously be that you're giving a lot of control to the theme modules and something would have to be done to ensure that a users site is decimated or bloated by the newly installed theme. In other words the theme module could easily provide too much unnecessary and complicated functionality as with other CMS options out there - yes, I'm looking at you WordPress.

Another interesting possibility would be to enable a system of overrides somehow, whereby any template files could be overridden from the installed theme module by creating an equivalent file in the templates directory in PW. This would then allow customisation of any theme modules and allow the theme module to be updated without losing the customisations. Or instead of this approach, a child theming system could be created where a child theme module could have a parent theme dependency, again, allowing a child theme to override the parent one.

Just a few thoughts  :)

  • Like 5
Link to comment
Share on other sites

Another option would be to let the theme define some required fields which you can assign. So you could use already existing fields. And maybe a button to create the rest of the needed fields. Or maybe all fields are optional.

Probably I go this way.

  • Like 1
Link to comment
Share on other sites

I quite like the idea, how you implemented the theme-changing in a module. But I currently don't see how you intended to get the link between the backend fields and the frontend presentation. From my point of view a theme is always more or less tightly coupled with a predefined form of content, which needs more than just some required fields to be present.

Link to comment
Share on other sites

Maybe "required" fields is the wrong word. It's more an alias. I really think that's the best way to go:

The designer just makes a design using generic stuff like $page->body, $page->headline, $page->images, whatever and defines them as "content fields" / "required fields".

Now the customer maybe already has a working side with some fields and just want to use a new theme. So he doesn't even has to go into the theme files and replaces fields to the already filled fields but just had to connect them. 

If you need more advanced stuff like repeater field contents, etc. I'm going to add Hanna Code support.

And to prevent misunderstandings: As the fields you define in the Theme configuration are only aliases you of course can still use $page->created, $page->title, etc.

Link to comment
Share on other sites

The problem I see, is that even $page->body is used differently by different users. I have seen Ryan use it to store the whole html of the current page, which is than echo'ed into the pagetemplate, while I mostly use it for wysiwyg-content. So to reach interchangeability of themes, there needs to be a base agreement about the coding style which is used by the different themes. 

Edit:

I don't think this would be a bad thing, as your module already does rely on the themes being catered for it, with the theme as module approach. 

  • Like 1
Link to comment
Share on other sites

The theme could be more abstract and consist of field renderers and css to style them. So you Install a theme which provide markup renderers for all field types (maybe a few for each). In the backend you choose which renderer to use for each field. You could choose not to render a field. All renderered fields could go in the main content area stacked or even use some kind of a sub-template to get more custom output.

This is how Seblod for Joomla works.

Maybe some kind of special profile could be developed which would be themable in an easy and consistent way.

But in the end, all this will turn into something less universal than PW without it.

Link to comment
Share on other sites

Another option would be to let the theme define some required fields which you can assign. So you could use already existing fields. And maybe a button to create the rest of the needed fields. Or maybe all fields are optional.

Probably I go this way.

Yes, I like this approach very much. Again, this seems to be an elegant way to handle the flexibility that ProcessWire provides. 

It's obviously going to take knowledge of how to use ProcessWire by the end user to be able to map the fields correctly, or a range of themes could be accompanied with an install profile. Either way we could achieve standardisation and flexibility all in one.

A profile could be created by a theme author specifically as a starting point to test the various themes they supply out. Currently this approach gives a lot of possibilities and permutations in creating themes.

It also gives ProcessWire CSS Zen Garden type functionality whereby installing the basic standard profile and then switching themes could provide all sorts of different looks to the frontend. All without too much complexity added, either in the theming system itself or in the individually installed themes.

Finally, a designer could use a theme module as a base, copy the files from it into the 'templates' directory. Uninstall the theme module and then use the files they have copied across into the templates folder as the basis for a site that they work on top of. This is then a very nice method for designers to learn how to use ProcessWire with a lower barrier to entry. Even better would be to have a system of overrides with the current theme still installed :)

The theme could be more abstract and consist of field renderers and css to style them. So you Install a theme which provide markup renderers for all field types (maybe a few for each). In the backend you choose which renderer to use for each field. You could choose not to render a field. All renderered fields could go in the main content area stacked or even use some kind of a sub-template to get more custom output.

This is how Seblod for Joomla works.

Maybe some kind of special profile could be developed which would be themable in an easy and consistent way.

But in the end, all this will turn into something less universal than PW without it.

This is an interesting concept and could help to make a theme more universal. However, would this not bring more complexity and bloat for the end user and theming system?

This is also similar (in concept) to how Drupal works as well with multiple and potentially redundant template files that can be overridden. It provides the possibility of a theme being able to cope with new fields and field types being used after initial install. However, it comes at a cost of having to provide field template files for so many different permutations and therefore much higher complexity and overhead when creating the themes.

  • Like 1
Link to comment
Share on other sites

  • 2 months later...

Hi

This thread is already quite old and I just found it.

IMHO there is much more important that a Theme to have a great CMS.

One great solution you can see here:

https://www.odoo.com/page/website-builder

Here you can very easily build your complete website without any PHP or HTML knowledge. OK it is written in Python but a very similar approach you can find here using PHP.

http://themes.creiden.com/?theme=Circleflip
scroll slow;y down the site and read the each single point. This is actually what a website consitst of. -> small blocks

Now try the demo: http://themes.creiden.com/circleflip/builder-demo/wp-login.php [demo:demo]
it is very comprehensible and easy to use and it saves a lot of time for designers.

All those approaches are based on blocks. Each block you can design and connect to its own css, which than even could be switched.
In other words you have lots of reusable Materials for building a website without major coding.

As each block is reduced to its own simplicity fields and its types could be assigned to each block and therefore would be themable. as the names of those blocks would stay the same throughout any theme.

IMHO this Website Builder from circleflip only would need to be integrated into processwire and processwire could provide instantly a complete fleet of differnt themes which even would include different functionality options.
There is another builder from wpbakery but it is not nearly as good as the one you have in circleflip.

One huge Manko of TYPO3 was always that they had no way of themeing until webempoweredchurch started using TemplaVoila for their templating engine and than Ron Hall build the framework for temnplaVoila on top of it. Since than TYPO3 was themable and you were able to very easily switch themes. As the development of TemplaVoila had been nearly stopped (developer quitted) the decision came up to build TYPO3-THEMES - http://typo3-themes.org

Meanwhile this TYPO3 Themes containes a very powerful way to reuse designs and flexible elements even in a nested way. While the solutions of the wordpress and odoo builders is more based on blocks, the TYPO3 Solution is some kind different. A Page has always a base design and than each extension and each flexible content element omes with its own design. As those elements are often usuable in a nested way the way the css and js is working needs to be more flexible.

In circleflip website builder you can neste some elements too, also here the css adjusts automatically to the new needs.

Mostly this is possible by using less (better choice) or sass and a processor which calculates the image sizes according to the column sizes.

In both versions Theming is later very easy.

At circleflip you can see already their potential which comes out from one simple template. Even a one page template can be realized without any hazlle.
With TYPO3 Themes the same is possible but until now they are still trying to release that great feature ;-)

TYPO3 and Processwire suffer in terms of Templates the same problem. IMHO they can compete very well with other CMS like wordpress if they would have not only THEMES and Profiles but also a way which makes it easy to build a website with all its design elements.

Like picking up the parts from your LEGO Box. 90% of webprojects I assume could so be finished in more or less one or two days instead of weeks and months until the real valuable content could be inserted by the customer. The biggest benefit of Processwire in comparison to TYPO3 woudl be that templating is actually way easier and much more flexible! So PW could really take the lead here by having a website build feature available.

--
Drupal by the way realized that two already years ago before the wordpress people came up with their builder solutions. Also here they are using blocks.
--
At Processwire there was a simple bocks module as a proof of concept - perhaps this woudl be a good starting point.

In addition there should be quite strikt conventions how the folder strukture of a theme has to be build up. Right now it is more do what they want style at processwire ;-) unfortunately.

Templates which you use are often mixed with some which got installed by extensions. and as everything gets sorted in an alphabeticall way it gets fast chaotic.

Better would be that all those example temoplates get installed in one folder and from this folder you actually COPY the ones you need to another folder which contains only the templates used in one site in front and in backend.

site/templates/examples/  contains all templates

site/templates/frontend/ contains all templates used on the frontend

site/templates/backend/ contains all those used in the backend

each of those template folders than have their own but always same structure:

i.e.

site/templates/frontend/theme-name/bootstrap/

site/templates/frontend/theme-name/css/

site/templates/frontend/theme-name/css/color_theme.css

site/templates/frontend/theme-name/css/syle.css

site/templates/frontend/theme-name/css/mystyle.css

site/templates/frontend/theme-name/css/font/

site/templates/frontend/theme-name/css/less/

site/templates/frontend/theme-name/css/extra/lightbox/

site/templates/frontend/theme-name/css/extra/fullcalendar/

site/templates/frontend/theme-name/css/extra/datatables/

site/templates/frontend/theme-name/documentation/

site/templates/frontend/theme-name/html/(with the html version of a template so designers can easily start working imediately)

site/templates/frontend/theme-name/images/

site/templates/frontend/theme-name/includes/

site/templates/frontend/theme-name/js/

site/templates/frontend/theme-name/section/

site/templates/frontend/theme-name/snippet/

site/templates/frontend/theme-name/_init.php
site/templates/frontend/theme-name/index.php

site/templates/frontend/theme-name/....

---
there also would need to be a file which module might be required by each Theme.
 

Link to comment
Share on other sites

I don't think a website-builder-tool for frontend is the way to go for processwire. Processwire is about structuring your data, making connections between that data and query that with the API. This is the work done in processwire for a developer or designer, to enable his clients (or himself) being able to collect the data and have it output in a proper way for a website or something else.

If you use a builder for frontend-editing, the end-user has control of the formatting and arranging of the data, which sometimes is not desired. In my opinion, a CMS has to make constraints for the data to ensure the integrity and applicability, the PW-backend is very useful for this. E.g. a user wants to have three featured items on the homepage, you can easily do this with a website-builder as well using three equal-width blocks. But what if the user wants four or more items? If the developer was clever he thought about this in advance and made a slider if more items are added. (You can argue that you maybe can also add a slider element in website-builder... well, then this is example is not the best, but i hope you get the point)

In conclusion, the developer of the website makes decisions for the end-user that his data is presented in the way the developer has supposed it to be. He is the expert in making the website usable for the visitor, the end-user is expert in his business and over his data. 

Btw. don't get me wrong, i like some of your ideas and i think themes should being brought into PW in any way former or later.

  • Like 2
Link to comment
Share on other sites

Hi pideluxe

You really should take your customers and test out some of those examples here and awaitthere reactions. We did it and do it regularly actually!

https://demo2.odoo.com/
go to "website" in the upper menu. Than choose from "Help" (Top Menue to the right) what you would like to do - create a page etc. It is fun and until now all our customers really like that, but only a few will be able to run it on their hosting spaces unfortunately. And it has also some drawbacks i.e. how it manages the digital content IMHO a bit chaotic - like Processwire withot Image manager or Gallery Module

https://www.odoo.com/page/start
go here fill in some name and up you go. Start building your website. You will be able to have a nice looking design even in front of yor customers eyes

Another great example:
http://themes.creiden.com/?theme=Circleflip
scroll down to the bottom and choose demo access demo:demo

Have a look also to their documentation which shows how userfriendly documentatins could be
http://docs.creiden.com/circleflip/

http://t3bootstraptv.de/de/typo3-bootstrap/
http://t3bootstrap.de/de/typo3-bootstrap-template/
http://www.t3sbootstrap.de/t3sbootstrap/

 

In conclusion, the developer of the website makes decisions for the end-user that his data is presented in the way the developer has supposed it to be. He is the expert in making the website usable for the visitor, the end-user is expert in his business and over his data.

Well our experience is just the opposite. really just the opposite. Of course yo can dictate your users what they are allowed and what not - dictator CMS ??? but this would stop the process for the customer which keeps things running because they are wired the right way to gether. I met lots of so called "experts" and they failed as they left the customers alone after they gave them the website. So justafter a few days new updates or even security updates came out and the customer had no idea how to handle that so he left things as is until his site was gone ;-) - Than he came to us and first really wondered why we taugt him how to handle those jobs. He is our customer since nearly 10 years meanwhile and he is only one of those examples out there. Meanwhile he manages his own SEO, he is good!, and he is master of his system and his content and happy about that. Nevertheless is he coming back every year to learn more and sometimes also to learna new system but than see that the former one is better for his needs as he is the master of ceremony. But also him fascinated Processwire like many others and they would immediately start using it when it would come with some better usability for END Users which is NOT the same as for Developers or Designers or Integrators or Site Builders etc.
 

E.g. a user wants to have three featured items on the homepage, you can easily do this with a website-builder as well using three equal-width blocks.

You have a very traditional client here I guess. well try out those website Builders or try out omne of those TYPO3 sites in the Backend or the Framework for TemplaVoila. Here you can decide very flexible to add or reduce columns, or to change the width of columns by drag and drop. You can move ELements to another column etc. You can work with Nested columns by drag and drop. Customers reallylike that new way of a creative website where they can decide by themselves how the site actually looks like. Meanwhile most customers demand one of our "no design" "Themes - well it is basically blank" and than they start designing it with images and text and dropcaps etc reaclly nice - and it is THEIRS!! They did it, we only provided them the right toolset to achive their goals to be Master of Ceremony!

Andi

Link to comment
Share on other sites

  • 4 months later...

Hi pideluxe

You really should take your customers and test out some of those examples here and awaitthere reactions. We did it and do it regularly actually!

https://demo2.odoo.com/

go to "website" in the upper menu. Than choose from "Help" (Top Menue to the right) what you would like to do - create a page etc. It is fun and until now all our customers really like that, but only a few will be able to run it on their hosting spaces unfortunately. And it has also some drawbacks i.e. how it manages the digital content IMHO a bit chaotic - like Processwire withot Image manager or Gallery Module

https://www.odoo.com/page/start

go here fill in some name and up you go. Start building your website. You will be able to have a nice looking design even in front of yor customers eyes

I am sorry @lisandi but odoo.com just cannot be taken seriously. I would never dream or risking implementing it for any clients or my own operations. http://www.sorryopenerp.com/ and other millions of horror stories all over the web. It is famous for all the wrong reasons. But it does some (1 or 2) pretty things.

Now, ProcessWire is very different in most aspects. It is not built by an army of beginner developers in a marketing driven frenzy creating the biggest mess of code the world has seen, like odoo (openerp) is. PW seems very methodically, slowly and steadily going about its development roadmap. Extremely well coded, well thought out and with practically no bugs. Secure and fast. So a massive effort like website builder/theming system will have to be separate for sure and to be a respectable match to its core it will probably take a long time to be designed and coded in a fashion that would make sense for it to be a worthy addition to PW ecosystem.

I am sure it will happen at some point but not in the next few weeks... :)

some good ideas/thoughts and suggestions floating about from everyone though.

Nico - I am going to play around with your setup and will report back what I find/think. Very nice to see something being done in this direction.

  • Like 1
Link to comment
Share on other sites

Check out this here Pidelux:

http://www.sorryopenerp.com/developers.html

http://www.sorryopenerp.com/blog.html

This site can't be taken seriously - sorry!
ODOO has critics like Processwire has them and as you might know people splitted up from odoo years ago
I guess you never have even tried to use Odoo, or Tryton or any other system of that kind!

You will find critics for all kind of systems - also for Processwire
i.e. here:

The idea was actually to show some great examples of website builders which are very user friendly and odoo has a great one and TYPO3 has great stuff to do so in the backend and in frontent, Drupal has got  it like Joomla and wordpress (check out the themes)

The idea of my post was not to secure a developers workplace by blocking developments into that very userfriendly direction which makes developers to submit every smaller change to a website simply obsolete.

---

Concerning "army of beginner developers" I would suggest you read the vitas of most people who post here in the forum and who build for or with processwire. I guess with Odoo you will find a much much higher percentage of qualified and non beginner developers - but developers with year long experience with all kind of CMS, ERP, Opensource Software solutions than with Processwire. Processwire is easy so that it attracts even a beginner and he/she can setup a website without any PHP know how! So you can setup an Odoo complete ERP,HRM,POS,ACCOUNTING,PROJECTMANAGEMNT,BLOG,WEBSITEBUILDER,.... and much much more in some minutes without any Python know how! Pretty similar!

It is therefore not a good style to complain about beginners like you have been one for sure also at some point!
Beginners of know much better what makes a Product a good product for the community as they are not so focussed of only one product like hard core old devs are already (focussed i.e. on only processwire, or only odoo)

Odoo is playing in a total different league, which processwire will neverever reach! It is meant for total different usage and user groups! Huge companies, institutions, organisations etc. are using ODOO since years very successfully and since Version 8 it has now the website builder which is a very new feature!

Nevertheless I guess that some people soon will move again over to Processwire after their announcements concerning the support of TYPO3 Versions. :-)
http://typo3.org/news/article/announcing-typo3-cms-45-extended-long-term-support-plans/



 

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
×
×
  • Create New...