On Wednesday, March 23, 2011 4:58:45 PM UTC-4, Hal Smith wrote: 
>
>  This is the kind of thing I have been wondering about: what is going on 
> under the hood?
>
> I was simply doing what the manual told me to do - even if I wasn't sure 
> what it wanted. The manual needs to be updated.
>
 
Note, if you're on p. 88 doing the "Say Hello" example, you have not yet 
gotten to the stuff about using layouts and {{include}} -- that stuff starts 
in p. 92 in the "Let's Count" section. Because ch. 3 is tutorial style, 
explanations tend to be limited to what's going on with the immediate 
example, so you learn the details progressively. On p. 87, you learn that 
returning a string from your controller function simply sends the string as 
is to the browser (it's not inserted into any view/template). On p. 88, you 
learn that if you return a dictionary (instead of a string), web2py looks 
for the associated view file (and uses the generic view if it can't be 
found). And then on p. 92, you learn about extending a layout template.
 
I think the instruction about editing index.html on p. 88 could probably be 
improved. First, where it says "the new file associated with the action", it 
should probably say "the view file associated with the action". Second, it 
should probably explicitly say to completely replace the existing index.html 
content with the example code to avoid confusion. I'll make some edits to 
help clarify.
 
As for the numbers above and below your message, I can't explain that. Are 
you sure your index.html includes only the text from p. 88 and your 
controller is just:
 
def index():
    return dict(message="Hello from MyApp")
 
Anthony

Reply via email to