> For the complete documentation index, see [llms.txt](https://coldbox.ortusbooks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://coldbox.ortusbooks.com/the-basics/modules/layout-and-view-renderings/layout-view-discovery.md).

# Layout/View Discovery

Discovery order ColdBox uses to locate module layouts and views based on the parent lookup settings.

The default order of overrides ColdBox offers is both `viewParentLookup & layoutParentLookup` to **true**. This means that if the layout or view requested to be rendered by a module exists in the overrides section of the host application, then the host application's layout or view will be rendered instead. Let's investigate the order of discover:

![](https://content.gitbook.com/content/XMVfvHPJ9ZanT1mSFxLz/blobs/BAg7GNfZuYqnHUEpHeTV/ModulesViewLookupTrue.jpg)

![](https://content.gitbook.com/content/XMVfvHPJ9ZanT1mSFxLz/blobs/fmOTeHNste7pQIRnfmuI/ModulesViewLookupFalse.jpg)

**viewParentLookup = true**

1. Host override module specific `(e.g. {HOST}/views/modules/myModule/myView.cfm)`
2. Host override common `(e.g. {HOST}/views/modules/myView.cfm)`
3. Module view `(e.g. /modules/myModule/views/myView.cfm)`
4. Default view discovery from host `(e.g. {HOST}/views/myView.cfm)`

**viewParentLookup = false**

1. Module view `(e.g. /modules/myModule/views/myView.cfm)`
2. Host override module specific `(e.g. {HOST}/views/modules/myModule/myView.cfm)`
3. Host override common `(e.g. {HOST}/views/modules/myView.cfm)`
4. Default view discovery from host `(e.g. {HOST}/views/myView.cfm)`

![](https://content.gitbook.com/content/XMVfvHPJ9ZanT1mSFxLz/blobs/dDGHBV6ZNnUL02eXwiIg/ModulesLayoutLookupTrue.jpg)

![](https://content.gitbook.com/content/XMVfvHPJ9ZanT1mSFxLz/blobs/nRsAQKGCrxXKIUoqPGMz/ModulesLayoutLookupFalse.jpg)

**layoutParentLookup = true**

1. Host override module specific `(e.g. {HOST}/layouts/modules/myModule/myLayout.cfm)`
2. Host override common `(e.g. {HOST}/layouts/modules/myLayout.cfm)`
3. Module layout `(e.g. /modules/myModule/layouts/myLayout.cfm)`
4. Default layout discovery from host `(e.g. {HOST}/layouts/Default.cfm)`

**layoutParentLookup = false** 1. Module layout `(e.g. /modules/myModule/layouts/myLayouts.cfm)` 2. Host override module specific `(e.g. {HOST}/layouts/modules/myModule/myLayout.cfm)` 3. Host override common `(e.g. {HOST}/layouts/modules/myLayout.cfm)` 4. Default layout discovery from host `(e.g. {HOST}/layouts/Default.cfm)`

Let's do some real examples, I am building a simple module with 1 layout and 1 view. Here is my directory structure for them:

```javascript
/simpleModule
  + layouts
    + main.cfm
  + views
    + simple
       + index.cfm
```

Now, in my handler code I just want to render the view by using our typical `event.setView()` method calls or implicit views.

{% tabs %}
{% tab title="BoxLang" %}

```js
// In a handler called simple.cfc
class{

  function index(event){
      // DO SOME CODE HERE

        // Set the view to render with a layout
      event.setView(view='simple/index',layout="main");
    }
}
```

{% endtab %}

{% tab title="CFML" %}

```cfscript
// In a handler called simple.cfc
component{

  function index(event){
      // DO SOME CODE HERE

        // Set the view to render with a layout
      event.setView(view='simple/index',layout="main");
    }
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://coldbox.ortusbooks.com/the-basics/modules/layout-and-view-renderings/layout-view-discovery.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
