Showing posts with label OrchardCMS-QuickTip. Show all posts
Showing posts with label OrchardCMS-QuickTip. Show all posts

Orchard CMS Quick Tip–No constructors found by AutofacUtil ConstructorFinderWrapper

Posted on: Wednesday, 7 October 2015 09:30

While writing an Orchard CMS driver class for a tutorial recently I found myself confronted with this error message. If this has happened to you then your gut instinct might be that you are going to have to learn something about Autofac and it might get complicated. Read on for a quick solution.

Orchard CMS Quick Tip–If you cast it they will come, or Accessing your field of dreams

Posted on: Tuesday, 6 October 2015 09:30

I see a lot of people coming up against issues trying to get at the fields they have added on their content types. If you can’t figure out how to access the data then read on to discover the important points you need to understand which will make accessing fields easy.

Orchard CMS Quick Tip–Zoned out, or Why changing Placement.info still doesn’t move your module

Posted on: Monday, 5 October 2015 09:30

This is a common problem that can catch out Orchard users and developers but after you learn this easy to remember tip you should be able to solve it quickly whenever you experience in the future.

Orchard CMS Quick Tip–No Persister for: SomePartRecord

Posted on: Friday, 2 October 2015 16:31

If you’re making a module with a record class and you start seeing errors saying that there is no persister for the part record class you’re working on then you have probably made this simple mistake.

Orchard CMS Quick Tip–A duplicate value cannot be inserted into a unique index

Posted on: Thursday, 1 October 2015 09:30

Work on an Orchard CMS widget had been going pretty well. It display OK and didn’t seem like it had any problems but each time I tried to save anything I’d get an exception thrown.

Orchard CMS Quick Tip–Curling up with Orchard, or brace line breaks without ReSharper

Posted on: Wednesday, 30 September 2015 09:30

Orchard CMS requires that all commits to the core use the JavaScript style curly brace positioning, where the opening brace is on the same line as the method signature. If you use ReSharper then it comes with an automatic .resharper file that applies this out-of-the-box but non-users can still get this functionality with plain vanilla Visual Studio.

Orchard CMS Quick Tip–Getting at the Orchard.Layouts JSON for your template defaults

Posted on: Tuesday, 29 September 2015 09:00

If you have started using the Orchard.Layouts module which has seen some pretty significant updates in the last few releases you might be wondering how you get at the JSON data that you’ve been finding in content part default layout data setting. There are two ways but both are a bit tricky.

UPDATE

It’s been pointed out to me by several people that this technique doesn’t work any more. I don’t know an alternative way to solve this, sorry.

What do I mean exactly?

When you have a LayoutPart attached to one of your content items you will see a section like this in its Content Definition page:

orchard-cms-getting-json-template

This data pre-populates the page when you create a new content item.

If you want to customise your own content types with LayoutParts that come with defaults its possible but their currently there isn’t anyway to access this through the admin panel directly. Instead you need to take one of the two courses listed below.

XML export

The first option is to export the data using the import/export module that comes with Orchard CMS. You can so it this way but then you will get the JSON data in xml encoded format so it will need extra processing.

Access the clipboard data

(Special thanks to Daniel Stolt, one of the core Orchard.Layouts developers, for this idea)

In Chrome you can select an element, hit Ctrl+C and then that JSON data is actually placed on the system clipboard, along with the plain-text of the element. It's how copy-paste works.

The trouble is that you probably don’t have an application installed that will paste clipboard data with the type “Chromium Web Custom MIME Data Format” so if you try to paste it back again all you will get is the plain text representation.

To get at this data you can use LINQPad to extract this hidden JSON data:

orchard-cms-getting-json-linqpad

Just follow these simple steps:

  1. Download LINQPad 4
  2. Paste this query into the query window:

    var s = (System.IO.MemoryStream)System.Windows.Forms.Clipboard.GetData("Chromium Web Custom MIME Data Format");
    System.Text.Encoding.Unicode.GetString(s.ToArray()).Dump();
    
  3. Set the Language to C# Statement(s) for multiline support. Note the (s) on the end.

  4. Query > Query Properties > Additional References > Add > Search Forms > Add System.Windows.Forms.dll reference > OK
  5. Run the query
  6. Bonus tip: File > Save to save the snippet for next time. You can load it back from the My Queries tab in the bottom corner.

Troubleshooting - NullReferenceException: Object reference not set to an instance of an object.

You copied something else into the clipboard while setting this up, copy the original back from Orchard.

Orchard CMS Quick Tip–Stop “Unable to launch the IIS Express Web server” SSL clashes

Posted on: Monday, 28 September 2015 11:27

When I’m working with Orchard I often want to have several copies of Visual Studio open, running several copies of Orchard for testing and comparison reasons. This is how I stopped the “Unable to launch the IIS Express" Web server” errors when I tried to launch two at the same time.

Orchard CMS Quick Tip–Orchard suddenly starts showing a 404 error for every page including the root

Posted on: Friday, 25 September 2015 11:18

As your working on your Orchard CMS website or maybe right after you have deployed it, you might suddenly find that nothing is working. If you’re getting a simple 404 page no matter what you try then this is the first thing you need to try.

Orchard CMS Quick Tip–Always Start Without Debugging

Posted on: Wednesday, 16 September 2015 19:26

When you’re working on Orchard CMS in Visual Studio you will probably be tempted to press F5 as you normally do to start the solution in a web browser. Don’t do it!

SOLVED: Error CS0246 The type or namespace name 'Orchard' could not be found while upgrading Orchard CMS

Posted on: Friday, 21 August 2015 16:51

Orchard CMS is a great asp.net MVC based CMS which is really flexible but as it stands its upgrade process is a long and complex process far from the simplicity of WordPress and other competitors. After you have followed their many-step upgrade process you will need to bring any custom themes or modules back into your main solution. At this point I started getting hit with compile time errors. With a huge solution like Orchard it can be be daunting task to figure out the solution but after some digging around I figured out what was causing this particular issue.