Re: [Zope] How do I create a folder full of "virtual" DTML objectsfrom records in a database records in a database
R. David Murray wrote: > http://www.yoursite.com/yourmethod/recordid This is really easy to do. Now, what do I have to do if I want to use URLs like this: http://www.yoursite.com/events/recordid/index.html http://www.yoursite.com/events/recordid/pics.html http://www.yoursite.com/events/recordid/[...]/edit The real data is stored in a RDBMS, only the user interface templates are in the ZODB. Currently I use the obvious: http://www.yoursite.com/events_display_info/recordid http://www.yoursite.com/events_display_pics/recordid etc. Is it possible to use methods which get the recordid and a possible /edit extension from the URL and create the requested objects on the fly? There was a discussion about this topic a few months ago but I don't remember the exact circumstances so it's difficult to search for in the mailing list archive. Cheers, Nils -- [EMAIL PROTECTED] | [EMAIL PROTECTED] (preferred) [EMAIL PROTECTED] | [EMAIL PROTECTED] ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] How do I create a folder full of "virtual" DTML objectsfrom records in a database records in a database
Chris Beaumont wrote: > > David, > > Thank you, I've been successful in setting up basic SQL methods, data > input forms and query forms, > the problem Ive been having is in trying to break each table record (one > row in a table, say) out into a separate DTML document.. with fields in > the record forming the parts of the document.. (I'm making a web > heirarchy of events which each have to have their own page with various > kinds of constantly changing information about the event on them.. > These pages have to live at relatively stable URLs.. (of course, it > doesnt matter if they are physical documents to a search engine..) Some considerations. 1. Duplicating data is bad. 2. Let the RDMBS do as much of the processing as possible. A possible solution (TMTOWTDI): create a dtml method 'create event'. its basically an encapsulation to simulate triggers. in this method make your call to the insertion of the data into the sql db. after that call you can create a ZClass or DTML document with the property that stores the primary key of the data record in the DB (if you do it as a dtml doc, you either want to clone, or pass its body, check out the ZQR). this is your basic association of your objects and the sql data. in a dtml method that lives above your objects have a body that basically calls a retrieval sql on the db which takes an arg for the id. The body of your dtml doc/ZClass(index_html) calls this method for presentation of its data passing its property as an arg. you can arrange your objects in whatever heirarchy you want as they will acquire the dtml method and the sql methods for presentation (or put it in the zclass). For deletion create a similiar trigger encapsulation method, delete row, delete object. caveat. DON't use this to display lots of events on a page (hideous performance). you're much better off going to the db directly and grabbing all the results you need perhaps with python brain for extra presentation info. Cheers Kapil > So far what Ive seen in the ZSQL Methods guide are lots of hints on how > to use SQL methods to build tables from my data, and how to build > interfaces to use a given SQL query to filter those tables by content.. > Which is great if you want lots of lists.. > > What I want to build are lists *and their linked documents* the > records' fields flowing into the meta tags and body text of many > individual objects. When a record is deleted from the source SQL table, > I want to be able to have that deletion propagate to the child > document.. > > Is a valid approach to iterate through all of the rows of the table, > taking one field of the individual record and using that to deliniate > the "ID" of the generated document, then writing the others out as HTML > through dtml-var tags? > > I know this seems like a stupid question, but it seems as if this is > such a common need that I cant help but feel that one of the available > products would address it. If one doesnt exist then yes, I'll have to > figure it out myself.. I've seen similar things done in some Zope > products.. so I know it can be done... What I was hoping for is for some > suggestions on the best way to go about it that didnt require me > figuring it out from scratch > > Thank you > > "R. David Murray" wrote: > > > > On Wed, 23 Aug 2000, Chris Beaumont wrote: > > > I need to take rows in an SQL database table, and create one or > > > several nested folders of web pages out of them.. > > > > I'd suggest checking out the ZSQL Methods manual, and then asking any > > questions that you still have (and there probably will be some!) > > > > > > ___ > Zope maillist - [EMAIL PROTECTED] > http://lists.zope.org/mailman/listinfo/zope > ** No cross posts or HTML encoding! ** > (Related lists - > http://lists.zope.org/mailman/listinfo/zope-announce > http://lists.zope.org/mailman/listinfo/zope-dev ) ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] How do I create a folder full of "virtual" DTML objectsfrom records in a database records in a database
On Thu, 24 Aug 2000, Chris Beaumont wrote: > Thank you, I've been successful in setting up basic SQL methods, data > input forms and query forms, > the problem Ive been having is in trying to break each table record (one > row in a table, say) out into a separate DTML document.. with fields in > the record forming the parts of the document.. (I'm making a web > heirarchy of events which each have to have their own page with various > kinds of constantly changing information about the event on them.. > These pages have to live at relatively stable URLs.. (of course, it > doesnt matter if they are physical documents to a search engine..) [...] > What I want to build are lists *and their linked documents* the > records' fields flowing into the meta tags and body text of many > individual objects. When a record is deleted from the source SQL table, > I want to be able to have that deletion propagate to the child > document.. Maybe I'm misunderstanding your question, or maybe I'm misuderstanding ZSQL methods , because it does seem pretty straightforward to me. I haven't done what I'm about to describe, though, so I could be way off base. It seems to me that what you want to do is have a ZSQL method that takes an argument from the URL (they can do that), where the argument is the 'id' of the record. Then your method uses that argument to retrieve *just* that row from your database. Then you have your html template filled in using the column variables from that record. No need to have actual document objects sitting around, just the template. If you delete a record the corresponding page is therefore gone. And you get stable URLs, if the ids don't change: http://www.yoursite.com/yourmethod/recordid --RDM ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] How do I create a folder full of "virtual" DTML objectsfrom records in a database records in a database
David, Thank you, I've been successful in setting up basic SQL methods, data input forms and query forms, the problem Ive been having is in trying to break each table record (one row in a table, say) out into a separate DTML document.. with fields in the record forming the parts of the document.. (I'm making a web heirarchy of events which each have to have their own page with various kinds of constantly changing information about the event on them.. These pages have to live at relatively stable URLs.. (of course, it doesnt matter if they are physical documents to a search engine..) So far what Ive seen in the ZSQL Methods guide are lots of hints on how to use SQL methods to build tables from my data, and how to build interfaces to use a given SQL query to filter those tables by content.. Which is great if you want lots of lists.. What I want to build are lists *and their linked documents* the records' fields flowing into the meta tags and body text of many individual objects. When a record is deleted from the source SQL table, I want to be able to have that deletion propagate to the child document.. Is a valid approach to iterate through all of the rows of the table, taking one field of the individual record and using that to deliniate the "ID" of the generated document, then writing the others out as HTML through dtml-var tags? I know this seems like a stupid question, but it seems as if this is such a common need that I cant help but feel that one of the available products would address it. If one doesnt exist then yes, I'll have to figure it out myself.. I've seen similar things done in some Zope products.. so I know it can be done... What I was hoping for is for some suggestions on the best way to go about it that didnt require me figuring it out from scratch Thank you "R. David Murray" wrote: > > On Wed, 23 Aug 2000, Chris Beaumont wrote: > > I need to take rows in an SQL database table, and create one or > > several nested folders of web pages out of them.. > > I'd suggest checking out the ZSQL Methods manual, and then asking any > questions that you still have (and there probably will be some!) > > ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] How do I create a folder full of "virtual" DTML objectsfrom records in a database records in a database
"R. David Murray" wrote: > > On Wed, 23 Aug 2000, Chris Beaumont wrote: > > I need to take rows in an SQL database table, and create one or > > several nested folders of web pages out of them.. > > I'd suggest checking out the ZSQL Methods manual, and then asking any > questions that you still have (and there probably will be some!) Or check out ZPatterns if you're braev ;-) Chris ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] How do I create a folder full of "virtual" DTML objectsfrom records in a database records in a database
On Wed, 23 Aug 2000, Chris Beaumont wrote: > I need to take rows in an SQL database table, and create one or > several nested folders of web pages out of them.. I'd suggest checking out the ZSQL Methods manual, and then asking any questions that you still have (and there probably will be some!) --RDM ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )