Jump to content

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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Nico,

After installing any of the two testing themes I get a blank white screen everywhere (back and front)...am I missing something? On Dev PW 2.4.11.

Share this post


Link to post
Share on other sites

Oops I thought I added no error messages. Yeah, no errors...yes debug is on...Let me try again...

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

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

With no doubt, but in my opinion themes are not there to be universal, as they should be interchangeable.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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.
 

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

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

Share this post


Link to post
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/



 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Gadgetto
      Status update links (inside this thread) for SnipWire development will be always posted here:
      2019-11-15 2019-10-18 2019-08-08 2019-06-15 2019-06-02 2019-05-25 If you are interested, you can test the current state of development:
      https://github.com/gadgetto/SnipWire
      Please note that the software is not yet intended for use in a production system (alpha version).
      If you like, you can also submit feature requests and suggestions for improvement. I also accept pull requests.
      ---- INITIAL POST FROM 2019-05-25 ----
      I wanted to let you know that I am currently working on a new ProcessWire module that fully integrates the Snipcart Shopping Cart System into ProcessWire. (this is a customer project, so I had to postpone the development of my other module GroupMailer).
      The new module SnipWire offers full integration of the Snipcart Shopping Cart System into ProcessWire.
      Here are some highlights:
      simple setup with (optional) pre-installed templates, product fields, sample products (quasi a complete shop system to get started immediately) store dashboard with all data from the snipcart system (no change to the snipcart dashboard itself required) Integrated REST API for controlling and querying snipcart data webhooks to trigger events from Snipcart (new order, new customer, etc.) multi currency support self-defined/configurable tax rates etc. Development is already well advanced and I plan to release the module in the next 2-3 months.
      I'm not sure yet if this will be a "Pro" module or if it will be made available for free.
      I would be grateful for suggestions and hints!
      (please have a look at the screenshots to get an idea what I'm talking about)
       




    • By Robin S
      I have had this module sitting in a 95% complete state for a while now and have finally made the push to get it out there. Thanks to @teppo for his Hanna Code Helper module which I referred to and borrowed from during development.
      http://modules.processwire.com/modules/hanna-code-dialog/
      https://github.com/Toutouwai/HannaCodeDialog
      HannaCodeDialog
      Provides a number of enhancements for working with Hanna Code tags in CKEditor. The main enhancement is that Hanna tags in a CKEditor field may be double-clicked to edit their attributes using core ProcessWire inputfields in a modal dialog.
      Requires the Hanna Code module and >= ProcessWire v3.0.0.
      Installation
      Install the HannaCodeDialog module using any of the normal methods.
      For any CKEditor field where you want the "Insert Hanna tag" dropdown menu to appear in the CKEditor toolbar, visit the field settings and add "HannaDropdown" to the "CKEditor Toolbar" settings field.
      Module configuration
      Visit the module configuration screen to set any of the following:
      Exclude prefix: Hanna tags named with this prefix will not appear in the CKEditor toolbar dropdown menu for Hanna tag insertion. Exclude Hanna tags: Hanna tags selected here will not appear in the CKEditor toolbar dropdown menu for Hanna tag insertion. Background colour of tag widgets: you can customise the background colour used for Hanna tags in CKEditor if you like. Dialog width: in pixels Dialog height: in pixels Features
      Insert tag from toolbar dropdown menu
      Place the cursor in the CKEditor window where you want to insert your Hanna tag, then select the tag from the "Insert Hanna tag" dropdown.

      Advanced: if you want to control which tags appear in the dropdown on particular pages or templates you can hook HannaCodeDialog::getDropdownTags. See the forum support thread for examples .
      Edit tag attributes in modal dialog
      Insert a tag using the dropdown or double-click an existing tag in the CKEditor window to edit the tag attributes in a modal dialog.

      Tags are widgets
      Hanna tags that have been inserted in a CKEditor window are "widgets" - they have a background colour for easy identification, are protected from accidental editing, and can be moved within the text by drag-and-drop.

      Options for tag attributes may be defined
      You can define options for a tag attribute so that editors must choose an option rather than type text. This is useful for when only certain strings are valid for an attribute and also has the benefit of avoiding typos.
      Add a new attribute for the Hanna tag, named the same as the existing attribute you want to add options for, followed by "__options". The options themselves are defined as a string, using a pipe character as a delimiter between options. Example for an existing attribute named "vegetables":
      vegetables__options=Spinach|Pumpkin|Celery|Tomato|Brussels Sprout|Potato You can define a default for an attribute as normal. Use a pipe delimiter if defining multiple options as the default, for example:
      vegetables=Tomato|Potato Dynamic options
      Besides defining static options as above, you can use one Hanna tag to dynamically generate options for another. For instance, you could create a Hanna tag that generates options based on images that have been uploaded to the page, or the titles of children of the page.
      Your Hanna tag that generates the options should echo a string of options delimited by pipe characters (i.e. the same format as a static options string).
      You will probably want to name the Hanna tag that generates the options so that it starts with an underscore (or whatever prefix you have configured as the "exclude" prefix in the module config), to avoid it appearing as an insertable tag in the HannaCodeDialog dropdown menu.
      Example for an existing attribute named "image":
      image__options=[[_images_on_page]] And the code for the _images_on_page tag:
      <?php $image_names = array(); $image_fields = $page->fields->find('type=FieldtypeImage')->explode('name'); foreach($image_fields as $image_field) { $image_names = array_unique( array_merge($image_names, $page->$image_field->explode('name') ) ); } echo implode('|', $image_names); Choice of inputfield for attribute
      You can choose the inputfield that is used for an attribute in the dialog.
      For text attributes the supported inputfields are text (this is the default inputfield for text attributes so it isn't necessary to specify it if you want it) and textarea. Note: any manual line breaks inside a textarea are removed because these will break the CKEditor tag widget.
      Inputfields that support the selection of a single option are select (this is the default inputfield for attributes with options so it isn't necessary to specify it if you want it) and radios.
      Inputfields that support the selection of multiple options are selectmultiple, asmselect and checkboxes.
      You can also specify a checkbox inputfield - this is not for attributes with defined options but will limit an attribute to an integer value of 1 or 0.
      The names of the inputfield types are case-insensitive.
      Example for an existing attribute named "vegetables":
      vegetables__type=asmselect Descriptions and notes for inputfields
      You can add a description or notes to an attribute and these will be displayed in the dialog.
      Example for an existing attribute named "vegetables":
      vegetables__description=Please select vegetables for your soup. vegetables__notes=Pumpkin and celery is a delicious combination. Notes
      When creating or editing a Hanna tag you can view a basic cheatsheet outlining the HannaCodeDialog features relating to attributes below the "Attributes" config inputfield.
      Advanced
      Define or manipulate options in a hook
      You can hook HannaCodeDialog::prepareOptions to define or manipulate options for a Hanna tag attribute. Your Hanna tag must include a someattribute__options attribute in order for the hook to fire. The prepareOptions method receives the following arguments that can be used in your hook:
      options_string Any existing string of options you have set for the attribute attribute_name The name of the attribute the options are for tag_name The name of the Hanna tag page The page being edited If you hook after HannaCodeDialog::prepareOptions then your hook should set $event->return to an array of option values, or an associative array in the form of $value => $label.
      Build entire dialog form in a hook
      You can hook after HannaCodeDialog::buildForm to add inputfields to the dialog form. You can define options for the inputfields when you add them. Using a hook like this can be useful if you prefer to configure inputfield type/options/descriptions/notes in your IDE rather than as extra attributes in the Hanna tag settings. It's also useful if you want to use inputfield settings such as showIf.
      When you add the inputfields you must set both the name and the id of the inputfield to match the attribute name.
      You only need to set an inputfield value in the hook if you want to force the value - otherwise the current values from the tag are automatically applied.
      To use this hook you only have to define the essential attributes (the "fields" for the tag) in the Hanna Code settings and then all the other inputfield settings can be set in the hook.
      Example buildForm() hook
      The Hanna Code attributes defined for tag "meal" (a default value is defined for "vegetables"):
      vegetables=Carrot meat cooking_style comments The hook code in /site/ready.php:
      $wire->addHookAfter('HannaCodeDialog::buildForm', function(HookEvent $event) { // The Hanna tag that is being opened in the dialog $tag_name = $event->arguments(0); // Other arguments if you need them /* @var Page $edited_page */ $edited_page = $event->arguments(1); // The page open in Page Edit $current_attributes = $event->arguments(2); // The current attribute values $default_attributes = $event->arguments(3); // The default attribute values // The form rendered in the dialog /* @var InputfieldForm $form */ $form = $event->return; if($tag_name === 'meal') { $modules = $event->wire('modules'); /* @var InputfieldCheckboxes $f */ $f = $modules->InputfieldCheckboxes; $f->name = 'vegetables'; // Set name to match attribute $f->id = 'vegetables'; // Set id to match attribute $f->label = 'Vegetables'; $f->description = 'Please select some vegetables.'; $f->notes = "If you don't eat your vegetables you can't have any pudding."; $f->addOptions(['Carrot', 'Cabbage', 'Celery'], false); $form->add($f); /* @var InputfieldRadios $f */ $f = $modules->InputfieldRadios; $f->name = 'meat'; $f->id = 'meat'; $f->label = 'Meat'; $f->addOptions(['Pork', 'Beef', 'Chicken', 'Lamb'], false); $form->add($f); /* @var InputfieldSelect $f */ $f = $modules->InputfieldSelect; $f->name = 'cooking_style'; $f->id = 'cooking_style'; $f->label = 'How would you like it cooked?'; $f->addOptions(['Fried', 'Boiled', 'Baked'], false); $form->add($f); /* @var InputfieldText $f */ $f = $modules->InputfieldText; $f->name = 'comments'; $f->id = 'comments'; $f->label = 'Comments for the chef'; $f->showIf = 'cooking_style=Fried'; $form->add($f); } }); Troubleshooting
      HannaCodeDialog includes and automatically loads the third-party CKEditor plugins Line Utilities and Widget. If you have added these plugins to your CKEditor field already for some purpose and experience problems with HannaCodeDialog try deactivating those plugins from the CKEditor field settings.
    • By horst
      Wire Mail SMTP

      An extension to the (new) WireMail base class that uses SMTP-transport

      This module integrates EmailMessage, SMTP and SASL php-libraries from Manuel Lemos into ProcessWire. I use this continously evolved libraries for about 10 years now and there was never a reason or occasion not to do so. I use it nearly every day in my office for automated composing and sending personalized messages with attachments, requests for Disposition Notifications, etc. Also I have used it for sending personalized Bulkmails many times.

      The WireMailSmtp module extends the new email-related WireMail base class introduced in ProcessWire 2.4.1 (while this writing, the dev-branch only).
       
      Here are Ryans announcement.



      Current Version 0.4.2
      Changelog: https://github.com/horst-n/WireMailSmtp/blob/master/CHANGELOG.md
      get it from the Modules Directory Install and Configure

      Download the module into your site/modules/ directory and install it.

      In the config page you fill in settings for the SMTP server and optionaly the (default) sender, like email address, name and signature.
      You can test the smtp settings directly there. If it says "SUCCESS! SMTP settings appear to work correctly." you are ready to start using it in templates, modules or bootstrap scripts.


      Usage Examples
      The simplest way to use it:
      $numSent = wireMail($to, $from, $subject, $textBody); $numSent = wireMail($to, '', $subject, $textBody); // or with a default sender emailaddress on config page This will send a plain text message to each recipient.
       
      You may also use the object oriented style:
      $mail = wireMail(); // calling an empty wireMail() returns a wireMail object $mail->to($toEmail, $toName); $mail->from = $yourEmailaddress; // if you don't have set a default sender in config // or if you want to override that $mail->subject($subject); $mail->body($textBody); $numSent = $mail->send(); Or chained, like everywhere in ProcessWire:
      $mail = wireMail(); $numSent = $mail->to($toEmail)->subject($subject)->body($textBody)->send(); Additionaly to the basics there are more options available with WireMailSmtp. The main difference compared to the WireMail BaseClass is the sendSingle option. With it you can set only one To-Recipient but additional CC-Recipients.
      $mail = wireMail(); $mail->sendSingle(true)->to($toEmail, $toName)->cc(array('person1@example.com', 'person2@example.com', 'person3@example.com')); $numSent = $mail->subject($subject)->body($textBody)->send(); The same as function call with options array:
      $options = array( 'sendSingle' => true, 'cc' => array('person1@example.com', 'person2@example.com', 'person3@example.com') ); $numSent = wireMail($to, '', $subject, $textBody, $options); There are methods to your disposal to check if you have the right WireMail-Class and if the SMTP-settings are working:
      $mail = wireMail(); if($mail->className != 'WireMailSmtp') { // Uups, wrong WireMail-Class: do something to inform the user and quit echo "<p>Couldn't get the right WireMail-Module (WireMailSmtp). found: {$mail->className}</p>"; return; } if(!$mail->testConnection()) { // Connection not working: echo "<p>Couldn't connect to the SMTP server. Please check the {$mail->className} modules config settings!</p>"; return; }  
      A MORE ADVANCED DEBUG METHOD!
      You can add some debug code into a template file and call a page with it:
      $to = array('me@example.com'); $subject = 'Wiremail-SMTP Test ' . date('H:i:s') . ' äöü ÄÖÜ ß'; $mail = wireMail(); if($mail->className != 'WireMailSmtp') { echo "<p>Couldn't get the right WireMail-Module (WireMailSmtp). found: {$mail->className}</p>"; } else { $mail->from = '--INSERT YOUR SENDER ADDRESS HERE --'; // <--- !!!! $mail->to($to); $mail->subject($subject); $mail->sendSingle(true); $mail->body("Titel\n\ntext text TEXT text text\n"); $mail->bodyHTML("<h1>Titel</h1><p>text text <strong>TEXT</strong> text text</p>"); $dump = $mail->debugSend(1); } So, in short, instead of using $mail->send(), use $mail->debugSend(1) to get output on a frontend testpage.
      The output is PRE formatted and contains the areas: SETTINGS, RESULT, ERRORS and a complete debuglog of the server connection, like this one:
       
      Following are a ...


      List of all options and features


      testConnection () - returns true on success, false on failures


      sendSingle ( true | false ) - default is false

      sendBulk ( true | false ) - default is false, Set this to true if you have lots of recipients (50+)


      to ($recipients) - one emailaddress or array with multiple emailaddresses

      cc ($recipients) - only available with mode sendSingle, one emailaddress or array with multiple emailaddresses

      bcc ($recipients) - one emailaddress or array with multiple emailaddresses

       
      from = 'person@example.com' - emailaddress, can be set in module config (called Sender Emailaddress) but it can be overwritten here

      fromName = 'Name Surname' - optional, can be set in module config (called Sender Name) but it can be overwritten here


      priority (3) - 1 = Highest | 2 = High | 3 = Normal | 4 = Low | 5 = Lowest

      dispositionNotification () or notification () - request a Disposition Notification


      subject ($subject) - subject of the message

      body ($textBody) - use this one alone to create and send plainText emailmessages

      bodyHTML ($htmlBody) - use this to create a Multipart Alternative Emailmessage (containing a HTML-Part and a Plaintext-Part as fallback)

      addSignature ( true | false ) - the default-behave is selectable in config screen, this can be overridden here
      (only available if a signature is defined in the config screen)

      attachment ($filename, $alternativeBasename = "") - add attachment file, optionally alternative basename


      send () - send the message(s) and return number of successful sent messages


      debugSend(1) - returns and / or outputs a (pre formatted) dump that contains the areas: SETTINGS, RESULT, ERRORS and a complete debuglog of the server connection. (See above the example code under ADVANCED DEBUG METHOD for further instructions!)


      getResult () - returns a dump (array) with all recipients (to, cc, bcc) and settings you have selected with the message, the message subject and body, and lists of successfull addresses and failed addresses,


      logActivity ($logmessage) - you may log success if you want

      logError ($logmessage) - you may log warnings, too. - Errors are logged automaticaly
       
       
      useSentLog (true | false) - intended for usage with e.g. third party newsletter modules - tells the send() method to make usage of the sentLog-methods - the following three sentLog methods are hookable, e.g. if you don't want log into files you may provide your own storage, or add additional functionality here

      sentLogReset ()  - starts a new LogSession - Best usage would be interactively once when setting up a new Newsletter

      sentLogGet ()  - is called automaticly within the send() method - returns an array containing all previously used emailaddresses

      sentLogAdd ($emailaddress)  - is called automaticly within the send() method
      Changelog: https://github.com/horst-n/WireMailSmtp/blob/master/CHANGELOG.md
       
       
    • By Robin S
      Sanitizer EasySlugger
      Allows the use of the EasySlugger library as Sanitizer methods.
      Installation
      Install the Sanitizer EasySlugger module.
      Usage
      The module adds four new sanitizer methods.
      slugger($string, $options)
      Similar to $sanitizer->pageName() - I'm not sure if there are any advantages over that method. Included because it is one of the methods offered by EasySlugger.
      $slug = $sanitizer->slugger('Lorem Ipsum'); // Result: lorem-ipsum utf8Slugger($string, $options)
      Creates slugs from non-latin alphabets.
      $slug = $sanitizer->utf8Slugger('这个用汉语怎么说'); // Result: zhe-ge-yong-han-yu-zen-me-shuo seoSlugger($string, $options)
      Augments the string before turning it into a slug. The conversions are related to numbers, currencies, email addresses and other common symbols.
      $slug = $sanitizer->seoSlugger('The price is $5.99'); // Result: the-price-is-5-dollars-99-cents See the EasySlugger readme for some more examples.
      seoUtf8Slugger($string, $options)
      A combination of utf8Slugger() and seoSlugger().
      $slug = $sanitizer->seoUtf8Slugger('价钱是 $5.99'); // Result: jia-qian-shi-5-dollars-99-cents $options argument
      Each of the methods can take an $options array as a second argument.
      separator (string): the character that separates words in the slug. Default: - unique (bool): Determines whether a random suffix is added at the end of the slug. Default: false $slug = $sanitizer->utf8Slugger('这个用汉语怎么说', ['separator' => '_', 'unique' => true]); // Result: zhe_ge_yong_han_yu_zen_me_shuo_3ad66c4  
      https://github.com/Toutouwai/SanitizerEasySlugger
      https://modules.processwire.com/modules/sanitizer-easy-slugger/
    • By Robin S
      If you've ever needed to insert links to a large number of files within CKEditor you may have found that the standard PW link modal is a somewhat slow way to do it.
      This module provides a quicker way to insert links to files on the page being edited. You can insert a link to an individual file, or insert an unordered list of links to all files on the page with a single click.
      CKEditor Link Files
      Adds a menu to CKEditor to allow the quick insertion of links to files on the page being edited.

      Features
      Hover a menu item to see the "Description" of the corresponding file (if present). Click a menu item to insert a link to the corresponding file at the current cursor position. The filename is used as the link text. If you Alt-click a menu item the file description is used as the link text (with fallback to filename if no description entered). If text is currently selected in the editor then the selected text is used as the link text. Click "* Insert links to all files *" to insert an unordered list of links to all files on the page. Also works with the Alt-click option. Menu is built via AJAX so newly uploaded files are included in the menu without the page needing to be saved. However, descriptions are not available for newly uploaded files until the page is saved. There is an option in the module config to include files from Repeater fields in the edited page. Nested Repeater fields (files inside a Repeater inside another Repeater) are not supported. Installation
      Install the CKEditor Link Files module.
      For any CKEditor field where you want the "Insert link to file" dropdown menu to appear in the CKEditor toolbar, visit the field settings and add "LinkFilesMenu" to the "CKEditor Toolbar" settings field.
       
      http://modules.processwire.com/modules/cke-link-files/
      https://github.com/Toutouwai/CkeLinkFiles
×
×
  • Create New...