Hi Chris,

thanks so much for taking the time to reply in such detail.  I think
controllers are going to take me a little more time to understand but
you've certainly made a good dent in it for me which is good.
Your recommendation of the web2py manual is a good idea and given that
its quite cheap I think i'll take it up. The trial version seems
pretty good so i'll get the full version too!

I was taking a look through the api documentation, though interesting,
still a bit over my head.

I guess I shall get going with building that blog, lemme see how I go,
I guess I'll be back here with any questions!

Thanks again

Michael Gardner

On Jan 17, 9:32 pm, cjparsons <[email protected]> wrote:
> Hi Mick
>
> I'm far from being an expert but I'll try and be helpful..
>
> web2py follows the Model-View-Controller arrangement for web
> applications. This approach is now common in many web frameworks
> because it allows you to separate different aspects of the
> application. In a large project they might be worked on by different
> people with different skills, somewhat independently of each other.
>
> Model - the way the data that's stored by the application is arranged
> (could be done by a database specialist)
> View - the way the web application looks and interacts with the user
> (web design & javascript specialist)
> Controller - all the 'program' that sits between the Model and the
> View, getting the right data for the user to see, allowing them to
> fill in forms etc. and storing new information back into the database
> (programming specialist)
>
> Controller functions have a view associated with them. Generally
> controllers will get some information from the database and present it
> to the user (by passing it to the view). Part of this might be a form
> that allows the user to add more information to the database or update
> information. The controller will handle the contents of the form and
> update the database using information defined in the model.
>
> In the example 'db' is a variable that is called to access the
> database (as set up in the model file). I wouldn't worry too much
> about what is happening behind the scenes for now - if you use the
> examples with your own example application you should see get a feel
> for how to use the framework.
>
> For example to take one of the simpler example controller functions:
> (as typed  here might have copying mistakes)
>
> def show():
>    id=request.vars.id
>    recipes=db(db.recipe.id==id).select()
>    if  not len(recipes): redirect((URL(r=request,f='recipes'))
>        return dict(recipe=recipes[0])
>
> This function is called when the user 
> visitshttp://my.application.com/show?id=1
>
> The variable 'request' contains information that came from the user's
> web browser.
> The 'id' variable passed at the end  of the URL is stored in another
> variable, 'id', just as shorthand to make the rest of the function
> simpler.
> the 'recipes=' line executes a select query on the database, fetching
> the recipes that have 'id' = 1 and putting the resulting rows into the
> variable 'recipes'.
> ''if not len(recipes)...' checks that at least one row was returned.
> If no rows were returned then the user is redirected to a page listing
> all recipes. The 'redirect' function uses an exception that means the
> show() function is quit at this point and the next line won't be
> processed in this case.
> Finally the 'return' passes the recipe information to the view as a
> dictionary. The view will be constructed to know how to present the
> different recipe fields.
>
> Like other frameworks, web2py gives you a set of tools that add web-
> related functionality (or an API). To use it you need to learn what
> tools are available and how to use them together, but not necessarily
> what is going on behind the scenes.
>
> The cookbook is good, but contains a lot less description and
> information than the web2py manual, which is available in PDF form for
> a very reasonable pricehttp://www.lulu.com/content/4968879
>
> Chris
>
> On Jan 16, 11:30 pm, mickgardner <[email protected]> wrote:
>
> > Hi there,
>
> > firstly wanted to say thanks to the developers for building such a
> > fantastic and easy to use web framework i especially like the
> > intuitiveness of the design and web application development
> > interface.
>
> > Secondly, an introduction and some questions.
>
> > I've been trying to learn django for a few weeks now by way of
> > building my own blog. I got to a decent stage where the blog would
> > actually be functional but I was constantly troubled by the django
> > 'newforms'.  Its honestly a dazzling array of functions and code that
> > was beyond my ability to learn.
>
> > I've recently undertaken at the age of 32/33 to teach myself
> > programming, having been in the web and IT industries for over ten
> > years as an analyst. I've got to the stage where I can build a few
> > decent console python applications & scripts, use classes, modules,
> > and create functions -  and have a basic level understanding of object
> > oriented programming.
>
> > But django newforms was just beyond me!
>
> > Enter Web2py, I've been working through the cookbook plus pdf file. I
> > got to page 11/12 "creating functions(Actions" and hit a small road
> > block:
>
> > Question: how does one learn how to build / develop / understand the
> > controllers? I looked at the code in 11/12 and wondered what it meant
> > exactly, this may be slightly made worse by the fact that the db in
> > the example is actually called 'db'. Was there a function called 'db'
> > in the code provided? How does one best learn to develop the
> > controllers and learn what the various functions in the example are?
>
> > Thanks for getting this far in your reading :-)
>
> > I hope I can learn from you all in some way and help contribute if I
> > can.
>
> > Kind regards
>
> > mickgardner
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to