durusmail: quixote-users: PTL and overall site structure
PTL and overall site structure
2004-10-12
2004-10-12
2004-10-12
PTL and overall site structure
Paul Moore
2004-10-12
I'm trying to build a web application, where I want to have a standard
site structure. The structure is easy enough to define via CSS and
DIVs (ie, it took me *days* to get the look right, and the resulting
HTML doesn't look hard enough to have taken that long :-)) Now, I want
to start building my site pages.

The problem I'm having is that the "standard" PTL approach which I see
in the demo, and elsewhere, doesn't feel particularly comfortable to
me. If I follow, pages get defined as functions along the lines of

    def page [html] (request):
        std_header()
        # Stuff to build the page content
        std_footer()

This seems odd to me - I see my site in a more object oriented way -
the standard format is a base class, and specific pages are
subclasses, which in general only override the "content" method, but
which could (for example) extend the "footer" method to add something
to the footer. Something more like

    class Page(SitePage):
        def content [html] (request):
            #whatever
        def footer [html] (request):
            SitePage.footer(self, request)
            "The information on this page is confidential"

You get the idea, I hope.

I'm sure this is possible, but I can't quite get my head round how I
structure things. Does anyone have any pointers to sample code that
handles pages like this, or some hints on how to structure my
interface like this (or, indeed warnings as to why this is a really
bad idea!)

Thanks,
Paul.

reply