What PHP Developers Need to Know When Working With Sitefinity

by Gregg Crystal May 24, 2017

We meet a lot of PHP Developers who have been tasked with developing in Sitefinity. This can turn out to be a very daunting task, and this post will focus on what PHP developers can do to learn the platform quickly and effectively.

1. You Need to Learn .NET, but Not All of .NET

Sitefinity is built on .NET, SQL Server, and a variety of Microsoft Technologies. When we people say 'working with Sitefinity' they also mean 'working with .NET'.

An understanding of .NET is essential to Sitefinity development. But, like most modern languages, .NET is C-based and looks a lot like many other languages that you've seen, including PHP.

It doesn't take long to learn the proper syntax for functions, classes, for-loops, etc. .NET has other syntax that might help you, but depending on your circumstances, you don't have to learn all of it.

Start with a beginner course in .NET from PluralSight or Lynda. Don't forget, Stack Overflow is your friend here.

2. Being an Expert in HTML and CSS is a Big Plus with Sitefinity

The goal of any CMS is to output HTML and CSS to the browser. So you'll obviously want to leverage your HTML and CSS knowledge with Sitefinity.

To do that, don't get too caught up with 'Web Forms'. Web Forms was a .NET technology that was designed to obfuscate HTML. In theory it was supposed to make web programming easier. In reality, it made it a lot harder, and most .NET programmers shun Web Forms for the newer technology, MVC.

When I hear PHP developers complain most about Sitefinity, the struggle is usually with Web Forms. Web Forms is a bear, and the controls that you use to create forms, tables, and to use AJAX have a VERY steep learning curve. Nothing is overly intuitive.

If you're starting a new Sitefinity project, you can start with an MVC-pure install, using Sitefinity Feather controls and Bootstrap.

MVC has much simpler syntax, and you'll be surprised as to how much MVC User Interface code actually looks like PHP code.

By that, I also mean you'll be surprised at how much MVC UI code actually looks like HTML, which you're already familiar with.

3. Use Module Builder Extensively

Get to know Module Builder! While there are some performance considerations with this Sitefinity feature, all in all, it's the perfect tool for creating UI components that have small data sets, like a testimonial widget.

A lot of the code is written for you.

4. Consider Using Angular or Some Other Wonderful Front End Javascript Library

Sitefinity 9.x and above supports the Web API out of the box, and auto generates API calls for your custom modules that you built with Module Builder.

What does this mean for you? It means you can create custom front end UI controls without knowing any .NET!

So if you already know Angular, using the Web API calls to get data from Sitefinity is a breeze.

5. If You Have to Read/Write to a Database, use the Entity Framework

The Entity framework is the best and quickest way to connect to your custom tables in a SQL Server database. So much of the grunt work of reading and writing data is handled for you by the framework, and you're only one PluralSight or Lynda course away from learning it.

Again, you don't have to become an expert in the Entity Framework to be productive. The basics will get you pretty far.

The Entity Framework supports building a Class in .NET first, and then the framework will actually create the database table for you. It's that simple.

6. What Do You Do If You're Stuck With Legacy Web Forms Controls?

If you're absolutely stuck with Web Forms controls that you must support, you could at least start new development with MVC and/or Angular. At the very least the pain of Web Forms can be contained with Legacy code.

Sitefinity supports Web Forms and MVC within the same project. Angular works with anything.

Of course, you have to get your Sitefinity version up to 7.x or so to take advantage of MVC.

 Take Control of Sitefinity