<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="41139" data-post-id="41139">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="zazaian" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/zazaian/120/4195_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  zazaian
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Also, now that I look at it, I’m wondering if this approach is different with Phoenix 1.3-rcX. Are there any substantive changes here? I’ll probably end up digging into the Phoenix.View module here anyway, but I figured it wouldn’t hurt to ask.</p>
<p>Thanks again,<br>
Mike</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="41139" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-render-a-template-inside-a-web-templates-folder-subfolder/1404/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-41139" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="41139"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #11"></div>
  </section>
</div>
    <div class="postbit" id="41145" data-post-id="41145">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="zazaian" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/zazaian/120/4195_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  zazaian
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Hey all - so for my purposes I’ve resolved this problem. Rather than trying to work around the <code>use MyApp.Web, :view</code> call, I went straight to the source and added the <code>pattern</code> option directly to the primary <code>MyApp.Web.view</code> definition:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">  # /lib/my_app/web/web.ex
  def view do
    quote do
      use Phoenix.View, root: "lib/my_app/web/templates",
        pattern: "**/*",
        namespace: MyApp.Web
      ..
     end
   end
</code></pre>
<p>This allowed me to create multiple sub-dirs within each view root directory (for my purposes this was <code>web/templates/page</code>), and then to call renders inside of master <code>index.html</code> template using relative paths from that root directory:</p>
<pre data-code-wrap="haml"><code class="lang-haml"># /lib/my_app/web/templates/page/index.html.haml
# please note that all of my view templates use HAML  
.container
  -# Top Section
  = render MyApp.Web.PageView, 'sections/_top_section.html'

  -# More Stuff Section
  = render MyApp.Web.PageView, 'sections/_more_stuff.html'

  -# Final Stuff Section
  = render MyApp.Web.PageView, 'sections/final_stuff.html'
</code></pre>
<p>Additionally, because I ended up with about 12 partials overall, and because my app name was pretty long, I decided to alias the PageView module within itself for easier partial calls:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir"># /lib/my_app/web/views/page_view.ex
defmodule MyApp.Web.PageView do
  use MyApp.Web, :view

  alias MyApp.Web.PageView
end
</code></pre>
<p>This made my primary index template a big more svelte:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir"># /lib/my_app/web/templates/page/index.html.haml
.container
  -# Top Section
  = render PageView, 'sections/_top_section.html'

  -# More Stuff Section
  = render PageView, 'sections/_more_stuff.html'

  -# Final Stuff Section
  = render PageView, 'sections/final_stuff.html'
</code></pre>
<p>Anyway, happy to answer any questions, or field any fire for doing any of these things incorrectly according to convention. Also please note that I’m using <strong>Phoenix 1.3-rc2</strong>, so this may be different for Phoenix 1.2.4 apps.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="41145" data-batch-url="/posts/batch_likers">
                        6
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-render-a-template-inside-a-web-templates-folder-subfolder/1404/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-41145" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="41145"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #12"></div>
  </section>
</div>
    <div class="postbit" id="41180" data-post-id="41180">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="axelson" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/axelson/120/26351_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  axelson
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Scenic Core Team</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<pre><code># /lib/my_app/web/web.ex
def view do
  quote do
    use Phoenix.View, root: "lib/my_app/web/templates",
      pattern: "**/*",
      namespace: MyApp.Web
    ..
   end
 end
</code></pre>
<p>Doesn’t using <code>Phoenix.View</code> like this mean that if you define a <code>Page.SectionView</code> you could either use <code>render PageView, 'sections/_top_section.html'</code> or <code>render Page.SectionView, '_top_section.html'</code>?</p>
<p>Not trying to advocate against your approach but just trying to think through the implementation (and make sure I’m understanding everything myself!).</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="41180" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-render-a-template-inside-a-web-templates-folder-subfolder/1404/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-41180" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="41180"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #13"></div>
  </section>
</div>
    <div class="postbit" id="41183" data-post-id="41183">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="steve" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  steve
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>If you were to use the <code>PageView</code> render, it would call the template path <code>/templates/page/sections/_top_section.html.eex</code>. If you were to use the <code>SectionView</code>, it would call the template path  <code>/templates/section/_top_section.html.eex</code>.</p>
<p>Edit: Remember, the path is always relative to the view being used. The <code>PageView</code> is prefaced with <code>/page</code> and the <code>SectionView</code> is prefaced with <code>/section</code>. So when you call render using the <code>PageView</code> and set the path as <code>/sections/file.html</code>, remember that it’s prefaced with <code>/page</code>, making the actual path <code>/page/sections/file.html</code>.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="41183" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-render-a-template-inside-a-web-templates-folder-subfolder/1404/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-41183" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="41183"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #14"></div>
  </section>
</div>
    <div class="postbit" id="41241" data-post-id="41241">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="zazaian" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/zazaian/120/4195_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  zazaian
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Hey there <a class="mention" href="/u/axelson" rel="nofollow">@axelson</a> - thanks for the question! I’m new-ish to using Phoenix in practice myself so I’ll do my best to field this one.</p>
<p><a class="mention" href="/u/steve" rel="nofollow">@steve</a>’s answer seems to be correct at least relative to what you may have meant. We’re only using <code>web/templates/page</code> as the presumed root dir for our view because we’re using the PageView to render templates.</p>
<p>That said, it seems like maybe you’re asking if adding namespaces to the view module itself would presume a new directory for each namespace in the template path. Is that correct? I’m not sure if that was just a typo.</p>
<p>If that’s what you meant, if you added a <code>Page</code> namespace to your SectionView, i.e. <code>MyApp.Web.Page.SectionView</code>, then it would automatically look for templates in <code>web/templates/page/section</code>, but not <code>web/templates/page/sections</code>. The directory structure is simply mirroring the camel-cased portion of the module before <code>View</code>. Consider:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir"># web/views/page/section_view.ex
module MyApp.Web.Page.SectionView do
  use MyApp.Web, :view
  # by default will look for templates in the root dir web/templates/page/section
end
</code></pre>
<p>However if you named your view <code>MyApp.Web.Page.SectionsView</code>, then both <code>PageView</code> and <code>Page.SectionsView</code> would use templates in the <code>page/sections</code> directory, though only the <code>Page.SectionsView</code> module would use that directory as its template root.</p>
<p>Does that answer your question? I’m glad to be discussing this because I’m learning a lot myself.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="41241" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-render-a-template-inside-a-web-templates-folder-subfolder/1404/16">Post #15</a>
	                </div>
	            </div>
              <div id="likers-container-41241" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="41241"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #15"></div>
  </section>
</div>
    <div class="postbit" id="156717" data-post-id="156717">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="TomBers" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/TomBers/120/32546_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  TomBers
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>This was very very useful.  Thank you.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="156717" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-render-a-template-inside-a-web-templates-folder-subfolder/1404/17">Post #16</a>
	                </div>
	            </div>
              <div id="likers-container-156717" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="156717"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #16"></div>
  </section>
</div>
    <div class="postbit" id="280385" data-post-id="280385">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="hunter" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  hunter
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>How has this changed with 1.7+?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="280385" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-render-a-template-inside-a-web-templates-folder-subfolder/1404/18">Post #17</a>
	                </div>
	            </div>
              <div id="likers-container-280385" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="280385"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-last-post cat-last-post" title="Last post!"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>