Im making a cms to meet the needs of our use and was just wondering the 
following:

if i create a function for adding a new page, where both tables page & 
page_content have their fields edited on the same page, what is the best 
method for the id & foreign key to match cleanly?
would it be that a page entry is pre-created before presentation to the 
user, to ensure the foreign key works, or should i make it populate as the 
page table entries are populated? or am i just talking nonsense and web2py 
can sort it all out on submit of all content?

page_content will be hidden if action is redirect.

The intention is that the content will be linked to blocks in the template, 
so if the template used (will be a file under templates rather than a row 
in the table) has multiple content blocks, the creation/edit page will 
provide the ability to add multiple blocks on this page.

my tables in the making are below:

db.define_table('page',
Field('title','string',required=True,label=T('Page Title')),
Field('menutext','string',unique=True,label=T('Menu Text')),
Field('pageurl','string',unique=True,required=True,label=T('Page URL')),
Field('template','string'),
Field('action','list:string'),
Field('active','boolean',default=True),
Field('searchable','boolean',label=T('Make Page Searchable?'),default=True),
Field('showinmenu','boolean',label=T('Show in Menu?'),default=True),
Field('metadata','text',label=T('Page Specific Meta Data')),
Field('created_on','datetime',default=request.now, label=T('Created On'),
writable=False,readable=False),
Field('modified_on','datetime',default=request.now, label=T('Modified On'),
writable=False,readable=False, update=request.now),
Field('parent','integer'),
format='%(title)')
db.page.action.requires=IS_IN_SET(('content','redirect'))
db.page.parent.requires=IS_NULL_OR(IS_IN_DB(db,'page.id'))

db.define_table('page_content',
Field('page',db.page),
Field('block','string'),
Field('content','text'),
Field('created_on','datetime',default=request.now, label=T('Created On'),
writable=False,readable=False),
Field('modified_on','datetime',default=request.now, label=T('Modified On'),
writable=False,readable=False, update=request.now))


got both the web2py book (can I get the pdf free as i purchased the dead 
tree edition?) and the recent e-book of web2py and think they are great, 
but made me think the following when it comes to a cms:

with the urls for pages, to ensure clean seo, it would be best in my 
opinion (for us anyway) to make the page names the args, so 
cms/page/PAGENAME/SUBPAGE and just use routing to take away the controller 
and functions, that way the arguments (PAGENAME/SUBPAGE) can be strung 
together as a field (pageurl), so a function doesn't need creating for 
every page. would this be problematic for me at all or would you see that 
as a ok plan of action?

been doing lots of research, but this is the bits i had to put my hand up 
on and ask. loving what i've seen so far with web2py.

Thanks,

Alan

Reply via email to