Tuesday 14 September 2010

More room for the editor labels

This is just a quick tip for an N2CMS MVC site that I've found literally as I'm just making a few changes to a site I'm doing at the moment so it's short and sweet!


One of my clients says that when they are editing a page the descriptive labels next to the textboxes, checkboxes and dropdownlists are a bit "squashed" and I have to say I agree. There's very little space given for the labels before they roll onto the next line.


Just change the /N2/Resources/Css/Edit.css file where it says:-
body.framed .itemEditor .editorLabel { width:110px; float:left; clear:left; padding:5px 5px 0 0; margin:0 0 5px 0; }
to
body.framed .itemEditor .editorLabel { width:210px; float:left; clear:left; padding:5px 5px 0 0; margin:0 0 5px 0; }
Your labels are now twice as wide and it looks much neater. I think I will include this is all my future N2 sites.

Cheers!

Friday 3 September 2010

Hosting companies that work with N2CMS

I just thought I'd share this with you and it may be something I revisit a few times in the coming months. I've seen a few people asking on the forums about which web hosts work with N2CMS.

I have a few clients where they had an existing web site that is maintained by an external company and they want a CMS site which they can maintain themselves. Usually they are likely to be non-technical users in smaller companies. As a result of this, they are generally reluctant to move hosting companies for a variety of reasons such as the cost to terminate a contract and set up a new one, previous good service and also having to do other things like changing DNS records and migrating emails.

The problem I then have is that I don't get to specify which hosting company to use, it's given to me! Obviously, I know which ones will work from previous experience.


As a result of this, one of the first things I do is my "one hour" test. Basically if I can't download the code, deploy a "vanilla site", configure a few settings, create and edit a couple of pages within the hour I think that it will be problematic later on. I may well be able to fix all the issues if I had more time, but this is my rule of thumb. 


I have worked with three hosting providers and one intranet so far and here's my findings.


  • ukfast.co.uk
    I had a few issues with them that I couldn't resolve in my hour which I suspect may have been related to medium trust. Luckily the client was moving to a new hosting provider anyway so it didn't matter in the end, but if you're going to deploy an N2CMS site to ukfast, double check it first! They may have upgraded their hosting services since, but check first.
  • discountasp.net
    I have had no problems with these at all - the only slight "gotcha" I had was that I had to make sure IIS7 to work in "integrated mode" with the N2CMS MVC project, but I suspect this was because I upgraded from IIS6 to IIS7. I used a SQL Server database server on these projects and it all worked no problem. I'd also say that when I emailed support about non-N2 matters they were very helpful and prompt which gave me confidence.
  • FastHosts.co.uk
    I have had no problems with these at all - everything worked out of the box. The only slight issue I had (although I suspect it wasn't a FastHost issue as such) was that we had to get them to set IIS to work on ASP.NET v2 which is something I'd have expected out of the box. I suspect this could just have been because the server was a few years old, but again it's something to double check. I used a MySQL database server on two projects and had no problems at all. I had to email support a question about MySQL database and again this was answered promptly.
  • Intranet server running IIS6
    Just make sure that the ASPNET account can write to the upload directory or similar if you plan to allow users to upload documents or images but overall, n
    o problems here - deployed the site onto the server and it worked no problem :)

The databases work no problem and there's no difference from I (or the client!) can tell with regards to speed with either SQL Server or MySQL.

I am sure that some of these issues may well be specific to the projects I worked on - especially as the servers had been used on older sites, but if you experience a couple of problems then it's worth just double checking that the settings are correct. If you have problems with you current host then from my own personal experience as someone who's created and deployed working N2CMS sites onto live servers, these hosts will work for you too! :)

Thursday 2 September 2010

Resizing images on N2

One of the main issues you have with CMS systems is clients uploading images. Usually they take some pictures on their cameras and just want to upload the images without having to edit it in Photoshop or some other editing software.

The parameters

The parameters are pretty self explanatory, but let's run through them to make sure.Remember these are all done via the querystring e.g image.ashx?img=picture.jpg&w=100&h=75

  • img - this is the url of your image and can be a url from anywhere on the site
  • w - this is the width of the image.
  • h - This is the height of the image. 
You can pass in the width, height or both parameters. If you only specified either the width or the height though then the handler will automatically resize your image to the correct proportions.

Note if you're using an N2 image property that you may need to remove the ~ at the start of the url. Also, you will need to URLEncode this so that spaces etc are handled correctly. If you don't see the image appearing on your page or it appears as a broken link, it's most likely to be because the handler cannot load the image.

I have found this really helpful when automatically resizing an image depending on where it is dropped on a page. For example, if we had a standard two-column page with a small left hand column and a wider main column on the right, we'd want to size the image so that it wasn't too big - or small - for the column.

If we had a "Photograph" part, you could check which parent Zone it was in and then pass in different values to the image.ashx handler!