On 5/19/07, <b class="gmail_sendername">James Britt</b> <<a href="mailto:james@neurogami.com">james@neurogami.com</a>> wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>The layout (example1.html):<br><br><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"<br> "<a href="http://localhost/TR/xhtml1/DTD/xhtml1-strict.dtd">http://localhost/TR/xhtml1/DTD/xhtml1-strict.dtd
</a>"><br><html xmlns="<a href="http://www.w3.org/1999/xhtml">http://www.w3.org/1999/xhtml</a>" lang="en"<br> xml:lang="en" mv:generate='layouts/example1.rhtml'><br> <head><title>Foo</title> </head>
<br> <body><br> <div id="doc2"><br> <div class="yui-gc"><br> <div class="yui-u first" id="main"><br> <div class='main' mv:content="yield">
<br> <h4>Welcome to my layout</h4><br> </div><br> </div><br> <div class="yui-u" id="sidebar" mv:content="yield :sidebar"><br> <p>This should be replaced by the actual sidebar</p>
<br> </div><br> </div><br> </div><br> </body><br></html><br><br><br><br>Here is the initial page1.html<br><br><html mv:import="layouts/example1.rhtml"><br> <span mv:generate="example/page1.rhtml">
<br> <h2>The Page 1 Subheader!</h2><br> <div mv:block="content_for :sidebar do"><br> <h3>Page 1 sidebar</h3><br> </div><br> </span><br></html></blockquote>
<div><br></div></div><br>James,<br><br>I didn't catch it earlier, but the simple solution is to add a mv:generate="something" to your layout on or inside your yield. Also for this to work properly we need to use the mv:gen_replace="yield" if we are doing it on the same element as the yield (otherwise the yield would occur in the other file, where as mv:gen_replace makes it happen in the outer file).
<br><br>MasterView was assuming that every template in a rails environment has content to render in addition to potentially generating a layout. So instead of having a file that only generates the layout. If you have it generate the layout and one of the view pages, then everything will work fine. The assumption is based on us wanting to have the minimum number of files, so we expected to make use of every one (to generate a view file in addition to potentially a layout).
<br><br><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"<br> "<a onclick="return top.js.OpenExtLink(window,event,this)" href="http://localhost/TR/xhtml1/DTD/xhtml1-strict.dtd" target="_blank">http://localhost/TR/xhtml1/DTD/xhtml1-strict.dtd
</a>"><br><html xmlns="<a onclick="return top.js.OpenExtLink(window,event,this)" href="http://www.w3.org/1999/xhtml" target="_blank">http://www.w3.org/1999/xhtml</a>" lang="en"<br> xml:lang="en" mv:generate='layouts/example1
<div style="direction: ltr;">.rhtml'><br> <head><title>Foo</title> </head><br> <body><br> <div id="doc2"><br> <div class="yui-gc"><br></div><div style="direction: ltr;">
<span class="q"> <div class="yui-u first" id="main"><br></span></div><div style="direction: ltr;"> <div class='main' mv:generate="example/page0.rhtml" mv:gen_replace="yield">
<br> <h4>This will be page0 content</h4><br> </div><br></div><div style="direction: ltr;"><span class="q"> </div><br> <div class="yui-u" id="sidebar" mv:content="yield :sidebar">
<br></span></div> <p>This should be replaced by the actual sidebar</p><br> </div><br> </div><br> </div><br> </body><br></html><br><br>In the above example I added a mv:generate="example/page0.rhtml" to the same line as the yield. Now when you rebuild it knows by the context/file switch that this is where the view starts.
<br><br>We definitely need to document this better, and if nothing else indicate an error condition when trying to rebuild. Maybe we can clean this up a bit and make it simpler, too.<br><br>Anyway let me know if this gets you going again.
<br><br>Thanks,<br><br>Jeff<br><br><br>