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
Provenance
- Commit
8a62f8c- Tree
1d1e02d- Author
Tj Holowaychuk <tj@vision-media.ca>- Committer
Tj Holowaychuk <tj@vision-media.ca>- Parent
10f4f52
3 files changed+22 added−3 removed
modified:docs/guide.1+7 added-1 removed
968 unmodified lines969 .P970 For documentation on altering the object name view res\.partial() \fIhttp://expressjs\.com/guide\.html#res\-partial\-view\-options\-\fR\.971 .972 .P973-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\.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"976+View 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+.P979+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 \fIres\.render(\'users\')\fR either \fIviews/users\.jade\fR, or \fIviews/users/index\.jade\fR\.980+.981 .SS "Template Engines"982 Below are a few template engines commonly used with Express:983 .984 .IP "\(bu" 41096 unmodified linesmodified:docs/guide.html+8 added-1 removed
191 unmodified lines192 <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 lines849 850 851 <p>For documentation on altering the object name view <a href="http://expressjs.com/guide.html#res-partial-view-options-">res.partial()</a>.</p>852 852-<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>854 855+<h3 id="View-Lookup">View Lookup</h3>856+857+<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>858+859+<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>860+861 <h3 id="Template-Engines">Template Engines</h3>862 863 <p>Below are a few template engines commonly used with Express:</p>864 698 unmodified linesmodified:docs/guide.md+7 added-1 removed
539 unmodified lines540 * _collectionLength_ length of the collection541 542 For documentation on altering the object name view [res.partial()](http://expressjs.com/guide.html#res-partial-view-options-).543 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.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.545 546+### View Lookup547+548+View 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_.549+550+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 _res.render('users')_ either _views/users.jade_, or _views/users/index.jade_.551+552 ### Template Engines553 554 Below are a few template engines commonly used with Express:555 618 unmodified lines