Skip to content
Myr

view lookup docs

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent 10f4f52 · Browse files · 3 files+22 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+22 added−3 removed

  • other:+22 added−3 removed

3 files+22 added−3 removed

modified:docs/guide.1+7 added-1 removed
968 unmodified lines
969.P970For documentation on altering the object name view res\.partial() \fIhttp://expressjs\.com/guide\.html#res\-partial\-view\-options\-\fR\.971.972.P973NOTE: be careful about when you use partial collections, as rendering an array with a length of 100 means we have to render 100 views\. For simple collections you may inline the iteration instead of using partial collection support to decrease overhead\.973\fBNOTE:\fR be careful about when you use partial collections, as rendering an array with a length of 100 means we have to render 100 views\. For simple collections you may inline the iteration instead of using partial collection support to decrease overhead\.974.975.SS "View Lookup"976View lookup is performed relative to the parent view, for example if we had a page view named \fIviews/user/list\.jade\fR, and within that view we did \fIpartial(\'edit\')\fR it would attempt to load \fIviews/user/edit\.jade\fR, whereas \fIpartial(\'\.\./messages\')\fR would load \fIviews/messages\.jade\fR\.977.978.P979The view system also allows for index templates, allowing you to have a directory of the same name\. For example within a route we may have \fIres\.render(\'users\')\fR either \fIviews/users\.jade\fR, or \fIviews/users/index\.jade\fR\.980.981.SS "Template Engines"982Below are a few template engines commonly used with Express:983.984.IP "\(bu" 4
1096 unmodified lines
modified:docs/guide.html+8 added-1 removed
191 unmodified lines
192<li><a href="#Error-Handling">Error Handling</a></li>193<li><a href="#Route-Param-Pre-conditions">Route Param Pre-conditions</a></li>194<li><a href="#View-Rendering">View Rendering</a></li>195<li><a href="#View-Partials">View Partials</a></li>196<li><a href="#View-Lookup">View Lookup</a></li>197<li><a href="#Template-Engines">Template Engines</a></li>198<li><a href="#Session-Support">Session Support</a></li>199<li><a href="#Migration-Guide">Migration Guide</a></li>200<li><a href="#" class="toggle">+</a> <a class="section-title" href="#">Request</a><ul class="section" id="section-Request">
648 unmodified lines
849850851<p>For documentation on altering the object name view <a href="http://expressjs.com/guide.html#res-partial-view-options-">res.partial()</a>.</p>852852<p>NOTE: be careful about when you use partial collections, as rendering an array with a length of 100 means we have to render 100 views. For simple collections you may inline the iteration instead of using partial collection support to decrease overhead.</p>853<p><strong>NOTE:</strong> be careful about when you use partial collections, as rendering an array with a length of 100 means we have to render 100 views. For simple collections you may inline the iteration instead of using partial collection support to decrease overhead.</p>854855<h3 id="View-Lookup">View Lookup</h3>856857<p>View lookup is performed relative to the parent view, for example if we had a page view named <em>views/user/list.jade</em>, and within that view we did <em>partial('edit')</em> it would attempt to load <em>views/user/edit.jade</em>, whereas <em>partial('../messages')</em> would load <em>views/messages.jade</em>.</p>858859<p>The view system also allows for index templates, allowing you to have a directory of the same name. For example within a route we may have <em>res.render('users')</em> either <em>views/users.jade</em>, or <em>views/users/index.jade</em>.</p>860861<h3 id="Template-Engines">Template Engines</h3>862863<p>Below are a few template engines commonly used with Express:</p>864
698 unmodified lines
modified:docs/guide.md+7 added-1 removed
539 unmodified lines
540 * _collectionLength_ length of the collection541542For documentation on altering the object name view [res.partial()](http://expressjs.com/guide.html#res-partial-view-options-).543544NOTE: be careful about when you use partial collections, as rendering an array with a length of 100 means we have to render 100 views. For simple collections you may inline the iteration instead of using partial collection support to decrease overhead.544__NOTE:__ be careful about when you use partial collections, as rendering an array with a length of 100 means we have to render 100 views. For simple collections you may inline the iteration instead of using partial collection support to decrease overhead.545546### View Lookup547548View lookup is performed relative to the parent view, for example if we had a page view named _views/user/list.jade_, and within that view we did _partial('edit')_ it would attempt to load _views/user/edit.jade_, whereas _partial('../messages')_ would load _views/messages.jade_.549550The view system also allows for index templates, allowing you to have a directory of the same name. For example within a route we may have _res.render('users')_ either _views/users.jade_, or _views/users/index.jade_.551552### Template Engines553554Below are a few template engines commonly used with Express:555
618 unmodified lines