Recent Posts and Articles
Over the weekend Benedek and Zoltán (me) have worked hard on something very new: adding PHP scripting support for Orchard!
Thanks to the Phalanger project it's possible to compile PHP scripts to .NET assemblies as well as run PHP scripts dynamically by defining the script source at runtime. This comes with full interoperability between the two platforms: PHP scripts can use .NET types and objects can be passed between PHP and .NET. So you can use PHP to script a .NET application like Orchard. Did I mention how awesome this is?
With our two new modules, Orchard Scripting Extensions and Orchard Scripting Extensions: PHP we deliver a set of services to enable running scripts using Orchard services, hooked into Orchard's events. Features are:
- Extensible scripting services: basically with implementing a very simple interface (IScriptingRuntime) you can write your own scripting runtime and thus extend everything that we've already written (see e.g the action below).
- Scripting actions: with the new Script Execution action scripts can be run when an event in the Rules engine is raised. This way scripts can be run e.g. when a content item is published or even scheduled.
- Dashboard testbed: under the Scripting admin menu item you can try out your scripts by running them immediately. The testbed has a decent syntax-highlighted editor thanks to the awesome ACE editor.
- PHP view engine: with the PHP view engine you can have .php views; that means, you can have themes written in PHP!
At last, the Orchard Hungary Team made it's debut as presenters in Hungary too (after being successful a month ago in Los Angeles). Hosted by the university we study at (Óbuda University) Zoltán and I held a session of one and a half hour length on introducing Orchard to a small audience of 20 people (which is the double of what we expected to see).
See the photos taken during the presentation on our Facebook page!
A while ago I mentioned how Orchard 1.6 will be running ASP.NET MVC 4, ASP.NET Web API, and NHibernate 3. I have already covered ASP.NET Web API in more detail in one of my ASP.NET MVC 4 Tutorials, ASP.NET MVC 4 Web API Routes and ApiController, but I thought I would at least give Web API a quick shoutout with Orchard CMS. As with all things Orchard, Web API works exactly as you would expect and can take advantage of the various services and extensions that come with Orchard.
In Orchard 1.6, Orchard Websites can use MySQL as a database along with SQL Server, SQL Express, and SQL Server Compact (Sql CE). Orchard CMS Developers can easily find affordable web hosting that comes with MySQL, making Orchard a very attractive option to small businesses and developers more familiar with MySQL than SQL Server. As you will see in this Orchard Tutorial, using Orchard and MySQL is just as easy as using SQL Server.
On the second day of Orchard Harvest one of the hackathon groups explored the idea of using graph databases, specifically Neo4j, in Orchard. I followed up on the topic and researched on how graph databases can play along in an Orchard module.
You can see the progress from the discussion I've opened. I've searched for .NET graph databases but couldn't really find any up-to-date project, even .NET drivers for graph databases are scarce. Neo4j seemed indeed like the best way to explore further: it's a very popular graph database and exposes a RESTful API so other pieces of software can use it even when they don't run on Java like the Neo4j itself. Fortunately Tatham Oddie and his team developed Neo4jClient, a .NET wrapper that provides a nice interface to interact with Neo4j through its web services.
It turns out that using Neo4jClient from Orchard is quite simple.
There are a number of ways to do this (as with most things Orchard!) but one way that we’ve found that is both easy and very useful is to store the value in the WorkContext.Layout. Because it’s dynamic you can add your own property and access it from anywhere else.
Imagine that you have a Customer which in turn has two Addresses: ShippingAddress and BillingAddress. These addresses or content items, just like the customer is.
Next, you want to create a content part editor where the user can edit the Customer fields as well as the fields of the two addresses.
Furthermore, the Address has a Country navigation property, where Country is a simple entity class, not a content item.
We want to enable the user to pick one of the available countries using a dropdown list.
LazyField<T> is a utility class that lives in the Orchard.ContentManagement.Utilities namespace and enables you to return a value in a lazy manner.