Archive for the ‘Uncategorized’ Category

When I migrated our Mura site to our new IIS7 servers, one problem I noticed is that the Mura 404 handler was no longer showing. Instead the default IIS 404 page was displaying.

This problem doesn’t only apply to Mura, it will crop up with framework or code that uses the onMissingTemplate handler. The fix is easy. Edit the web.config file in the webroot, look for an httpErrors tag. It might look like this:

You need to add existingResponse="PassThrough" to it. If that element is missing completely, just add it with the necessary attribute.

Fixed!

The other day I had the need to align some data in an html cfgrid. There are some alignment attributes of the cfgriditem tag, but they do not work in html grids. I tried wrapping the data in a span tag with some css aligning it, but that didn’t work either.

But there is a way. When CF8 generates the grid it writes out CSS ids and classes that you can use to style the grid. For example to right align the 5th column you can use this:

.x-grid-td-5 {text-align:right;}

The number you need to use in the class name does not always match up with the column. Sometimes I had to use .x-grid-td-8 to reference the 6th column for example. I think the number increments for each cfgrid item, even if you have display=no.

If you have more than one cfgrid on your page and only want to align the nth column in one of them, you can wrap the cfgird in a div with an ID so you can reference only that grid in your CSS.

I just discovered a neat feature of CF9. Sometimes when calling a built in function or even a custom method, you get returned an array. But sometimes you only need one element in that array. In Perl and other languages its possible to directly access the element you want. I’m glad to see this has been added to ColdFusion9.

For example, lets say you need the second particular element in an XML document. You might fetch some XML with cffeed and then use XMLSearch() to get all the matching elements. Then reference the second element of the resulting array, like this:
Continue reading ‘Referencing returned value array values in CF9’ »