User templates

If you have ever developed a website with a CMS, you have probably had to decide more than once if you should write a module for a piece of content on the website or not. Sometimes, a module is just overkill for content which will not be updated very frequently, so you decide not to develop a module. Fair enough, let’s use editor templates in CKEditor instead.

Editor templates are helpful if you know how they work and as a (frontend) developer, you should understand how they work. Alas, your average CMS user probably won’t. She/he will manage to screw up your template from the moment they try to modify the content.

That’s why we decided we needed something different.

Start tracking your errors

When you are writing code, creating advanced Fork CMS modules and themes, or adding new features, sometimes you break things. Fork CMS uses logs and can send you an email when an exception occurred, but for larger websites this isn’t that useful because you don’t know if you’ve seen that issue before, or if it’s been fixed in the past. Moreover, you don’t know the severity of the issue. Has it occurred once or is this error popping up every 10 seconds? In this article, we explore the use of error tracking software such as Rollbar.

Using Symfony's Event Dispatcher in Fork CMS

Symfony's Event Dispatcher has been around in Fork CMS for some time now, but is only recently being integrated in our modules. It's not hard to use it though, and it's a great tool to decouple code in your modules. This post will explain in small steps how you can use it in your own Fork CMS modules.

Module specific services

Since Fork CMS version 3.9.2, our Fork modules look a little more like Symfony Bundles. They can now contain a so called "module extension" class that can be used to load module specific configuration or services.

This blogpost explains how you can start using this "module extensions" to write cleaner decoupled code in Fork CMS.

Using SwiftMailer in Fork CMS

Since our 3.9 release, all mail communication runs through the Swiftmailerbundle. This is the officially supported way of sending mails through Symfony. It's  based on the widely used and well documented library Swiftmailer.

The cookie bar

There is a lot of discussion about the European Cookie Law. Where each country has his own implementation it isn't that easy to find a way to handle them based on the country, because it doesn't only depend on the country per user, it depends on who you target.

Therefore in the upcoming 3.7-release we implemented the most strict cookie law, which should fullfill for all countries.

How it works

A cookie bar is available in the template (you should include it in your custom theme). The cookie bar is visible the first time a visitor enters the website, when he hasn't a functional cookie set to hide the bar.

When the visitor hasn't a cookie (cookie_bar_agree) set all tracking is disabled and the data send to Google Analytics is anonymised.

When a user clicks he disagrees a functional cookie is set to hide the cookie bar, and a cookie (cookie_bar_agree) is set to false. The cookie bar will not be visible from then on. When this happens no tracking is done, and the data for Google Analytics is anonymised.

When a user clicks he agrees the same the cookie for hiding the bar is also set, and the cookie_bar_agree-cookie is set to true. From then on the cookie bar will not be visible, the Fork-tracking is enabled and the data for Google Analytics isn't anonymised anymore.

Consequences

  • The first visit of a user will always be anonymized.
  • If a visitor doesn't allow cookies, the visitor will be unique for each request.

CommonCookie::hasAllowedCookies()

This method returns if a visitor has allowed the usage of cookies. If you are using tracking-cookies in your own code, you should use this method to check if it is allowed.

Tip: Hidden actions

Some modules in Fork CMS have backend actions that are not visible in the menu. These are functions you don't need for regular website management but can come in handy when doing specific tasks. You access these actions by directly entering the url in your browser's address bar.

New in Fork CMS 3.6.2: Better event-tracking for Google Analytics

External links (or Outbound links) are not tracked by Google Analytics, although it can be helpful to have data about the amount of clicks on a certain link. Since the beginning of Fork CMS 3 we track outbound links by adding an event tracker on the link. In our newest release we improved the tracking by adding support for mailto-links and internal anchors.

The script is based on an example of Lars Corneliussen. It provides a nicer overview of all tracked links in your Google Analytics.

Top events in Google Analytics

Example usage: Use a secondary dimension in Google Analytics to see on which page mailto links were clicked.

Google Analytics mailto events with secondary dimension

Developers can review the changes in the pull-request on GitHub.

Say hello to our new documentation

Since the moment Fork CMS went open-source people were asking about more documentation. We made guides to build extensions and posted extra information on our blog. Still we felt we couldn't keep up the demand on information that our community was asking for.

Our new system is based on GitHub, which is made for collaboration. It gives our community the opportunity to spread their knowledge using the system they already know. The articles are written using Markdown which allows writers to focus on their content instead of worrying about html. All the markdown data that is stored on GitHub gets cached onto our website and is converted to html through the GitHub Markdown renderer. The result is having the benefits from both displaying documentation right through our website and having powerful GitHub collaboration features.

The first two guides Installation and Getting Started are made to welcome newcomers to setup their very first Fork CMS website. They show best practices and help overcome the most common problems. In the User Guide some of the basic principles about using our system gets explained. Another worth mentioning new guide is about contributing. In these articles gets explained how decisions within Fork as an organisation are made and how you can improve the CMS in all different areas.

This is the start of what we think good documentation should look like. We want to keep improving the available information and we look forward to see our community's contributions.

Take a look and share your feedback!