RandomEtc/ejs-locals — pull request #8 by ball-hayden (2012-09-04 18:36:51+00:00)
Title: Use settings.views to find the layout directory

The attached could possibly be tidied up a little more, but uses options.settings.views as the layout directory rather than trying to find a layout in the same directory as the file to be rendered.
This allows file trees such as the following:
```
root
|-layout.ejs
|-index.ejs
|-user
|-edit.ejs
|-list.ejs
```
where `edit.ejs` and `list.ejs` use the same layout as `index.ejs`.
Previously, `index.ejs` would have correctly been rendered with `layout.ejs` (assuming `app.locals({ _layoutFile: 'layout.ejs' });` had been set), but `edit.ejs` and `list.ejs` would have been looking for a `layout.ejs` file in the `user` directory.

This may also help with your `FIXME` on line 110, as I think view engine should be accessible using options.settings['view engine']. I haven't changed that in this pull request as I'm not quite sure what you want to do with it.