Developing for Fork CMS 3.5

  • Written by Dieter Wyns on Tuesday 19 March 2013
  • 3 comments

Like you could read in a previous article on our blog the 3.5 release of Fork CMS has the first components of Symfony: HTTPKernel, HTTPFoundation and Dependency Injection. Switching to Symfony brings a lot of new functionality but also means that some things have changed for developing a module.

Howto create a frontend widget

  • Written by Tijs Verkoyen on Monday 19 September 2011
  • 8 comments

Because of the lack of documentation, and multiple people were asking how to execute custom code on the frontend, I wrote a brief howto on creating widgets on the frontend.

Widgets are items you can link to a block on a page. An example of a widget is a content-block. In this article we'll explain how to create your own widget that shows the last 5 tweets of your Twitter-account. We assume you have the basic fork installation covered.

addOpenGraphData: Open Graph Protocol in Fork

With the 2.6.0-release we introduced some new methods to handle meta-information:

  • addLink: add a link-item (e.g.: stylesheet, rssfeed, ...)
  • addMetaData: add a meta-tag (e.g.: keywords, robots, ...)
  • addMetaDescription: add a meta-description
  • addMetaKeywords: add meta-keywords
  • addOpenGraphData: add Open Graph data

I'm not going to explain each of these methods in detail. They are pretty self-explanatory. All you should know is that they won't overwrite the current value, unless you tell them to do so. This is for all meta-tags, except for the meta-keywords-tag, meta-description-tag and meta-robots-tag. For these specific items the value will be appended.

One method I want to explain somewhat more in depth: addOpenGraphData.

What is the Open Graph Protocol?

The Open Graph protocol enables any web page to become a rich object in a social graph. For instance, this is used on Facebook to enable any web page to have the same functionality as a Facebook Page.

Basicaly it means that you add some info into the HTML of your page, that other websites (like Facebook) can use to build a correct and rich snippet of your site.

What about Fork?

In Fork it is implemented by default in the Blog-module. The only thing you need to do is add your Facebook profile-id in the Settings-tab. When that is done, you can check the source-code for a blog-article. If you look in the head-section you will see all Open Graph data is present.

How can I do this in my own module?

The only thing you need to do is using the addOpenGraphData-method. It has 3 arguments:

  • $key: the Open Graph-property (you don't need to include the og:-part).
  • $value: the value for the property.
  • $overwrite: should the current value be overwriten. In most cases this will be true.

How can I verify the result?

If you put a lot of time in setting the correct tags, it would be nice to verify the result. Well, at https://developers.facebook.com/tools/lint you can test your page.

So if you are building a new module, try it out and make it easy to share the correct content on Facebook (or any other platform that supports Open Graph Data). If you have any questions or remarks, feel free to post them below.

Fork CMS on YouTube

Did you know Fork CMS has a YouTube channel? We'll be posting screencasts, both for developers and end users there. View the channel and don't forget to subscribe.

This is one of the screencasts already there, showing you how to connect your Google Analytics account to Fork CMS so you can view your visitor stats right inside Fork. There will be new screencasts soon — tell us what you want to see explained in the comments!

P.S. Since the interface is likely to change a little bit in the future these screencasts are deliberately low-tech.