Hi, I want to produce a home-page on my site using a URL like : http://www.zope.org/Members/Fred I'm a little confused as to how I would go about this in a dynamic way where I would pull the contents of the page out of a database. A non-database way would be to : /Members (folder) /Fred (sub-folder or Document) /Jim (sub-folder or Document) /Jane (sub-folder or Document) But I want to be able to generate the /Members/Fred page dynamically. The SQLMethod part I can do, its the structuring of the objects in the heriarchy which baffles me. Ideally I'd like to have a "Members" folder in /, as this reduces the clutter in /, but then how do I pick up the "Fred" part of the URL once I have traversed into the members folder and apply it as part of a SQLMethod? - Ian Sparks.
At 17:23 05.06.00 +0100, Ian Sparks wrote:
Hi,
I want to produce a home-page on my site using a URL like :
http://www.zope.org/Members/Fred
I'm a little confused as to how I would go about this in a dynamic way where I would pull the contents of the page out of a database.
A non-database way would be to :
/Members (folder) /Fred (sub-folder or Document) /Jim (sub-folder or Document) /Jane (sub-folder or Document)
But I want to be able to generate the /Members/Fred page dynamically.
The SQLMethod part I can do, its the structuring of the objects in the heriarchy which baffles me.
Ideally I'd like to have a "Members" folder in /, as this reduces the clutter in /, but then how do I pick up the "Fred" part of the URL once I have traversed into the members folder and apply it as part of a SQLMethod?
- Ian Sparks.
You can find a solution in the PTK-Source ******************************************** * Philipp Dunkel ICQ# 60149094 * * zReal Productions * * meet me at DALNet chan #phidu * ********************************************
I have the source here, perhaps you can point me to where I should be looking - the PTK is reasonably large. AFAICS the PTK uses a folder called Members and adds folders under that for each registered user : Members Fred FredContent1 FredContent2 FredContent3 Jim JimsContent Nothing database-driven about that. Thanks for your help. - Ian. ----- Original Message ----- From: "Philipp Dunkel" <phidu@gmx.net> To: "Ian Sparks" <isparks@wmute.u-net.com>; <zope@zope.org> Sent: Monday, June 05, 2000 5:36 PM Subject: Re: [Zope] www.mysite.com/Members/<someone> At 17:23 05.06.00 +0100, Ian Sparks wrote:
Hi,
I want to produce a home-page on my site using a URL like :
http://www.zope.org/Members/Fred
I'm a little confused as to how I would go about this in a dynamic way where I would pull the contents of the page out of a database.
A non-database way would be to :
/Members (folder) /Fred (sub-folder or Document) /Jim (sub-folder or Document) /Jane (sub-folder or Document)
But I want to be able to generate the /Members/Fred page dynamically.
The SQLMethod part I can do, its the structuring of the objects in the heriarchy which baffles me.
Ideally I'd like to have a "Members" folder in /, as this reduces the clutter in /, but then how do I pick up the "Fred" part of the URL once I have traversed into the members folder and apply it as part of a SQLMethod?
- Ian Sparks.
You can find a solution in the PTK-Source ******************************************** * Philipp Dunkel ICQ# 60149094 * * zReal Productions * * meet me at DALNet chan #phidu * ********************************************
Ian Sparks wrote:
I have the source here, perhaps you can point me to where I should be looking - the PTK is reasonably large.
AFAICS the PTK uses a folder called Members and adds folders under that for each registered user :
Members Fred FredContent1 FredContent2 FredContent3 Jim JimsContent
Nothing database-driven about that.
See below... ...
I want to produce a home-page on my site using a URL like :
http://www.zope.org/Members/Fred
I'm a little confused as to how I would go about this in a dynamic way where I would pull the contents of the page out of a database.
A non-database way would be to :
/Members (folder) /Fred (sub-folder or Document) /Jim (sub-folder or Document) /Jane (sub-folder or Document)
But I want to be able to generate the /Members/Fred page dynamically.
What exactly would you generate this off of? I would guess from data in a databse (SQL)? If so, you could do a select statement to ge tthe userlist. You would then make a 'template' that built a page from the data in a database, where username==username (ie Fred). But, you could be asking for something completely different. ;)
Bill, Thanks for the reply. Yes, I would be getting the data from a SQL statement. Let me explain what I am trying to achieve. I want to structure my site like this : http://mysite.com/Members/<username so if someone comes to my site with the URL : mysite.com/Members/Ian They would see the Members page for "Ian" (we'll ignore permissions and security for now). As I have said before, one way of doing this is to have a Zope structure : /Members /Ian /Jim /Jane Where Members is a folder, Ian,Jim and Jane are Sub-folders of Members. But I don't want to do this. What if I add a million users? Then I end up with a million member folders which is difficult to manage from Zope. I want to store my users in a database. I have no problem creating a DTML method which calls a SQLMethod passing a parameter "username=Ian" to pull out the data and construct the HTML for delivery. The problem I have is how to construct my site. What I want is something like : /Members /* Where * is a method which catches the rest of the url (/Ian) and does all the necessary processing to return the formatted user page for Ian. I know I'm missing the Zope Zen of this because it must be easy to do in such a well thought-out product. The thought I had was that "Members" could be a SQL method which takes "username" as a parameter, Ian then is passed in as that Username and the necessary data is pulled from the DB. This is fine except that I still need some other method to render the HTML page for delivery to the user and this would extend my url to : www.mysite.com/Members/Ian/rendermethod. The other problem with this is that it clutters the root with the Members SQLMethod and the rendermethod DTML document. I might start adding more URL's like : www.mysite.com/Members/Ian/preferences or www.mysite.com/Members/Ian/pastposts and the "preferences" and "pastposts" documents would end up in the root too. All these things belong in a Members folder, not at the root. I'm missing something important, I'd appreciate any enlightenment you could bring to this. - Ian. ----- Original Message ----- From: "Bill Anderson" <bill@libc.org> To: "Ian Sparks" <isparks@wmute.u-net.com>; <zope@zope.org> Sent: Tuesday, June 06, 2000 10:32 AM Subject: Re: [Zope] www.mysite.com/Members/<someone> Ian Sparks wrote:
I have the source here, perhaps you can point me to where I should be looking - the PTK is reasonably large.
AFAICS the PTK uses a folder called Members and adds folders under that
for
each registered user :
Members Fred FredContent1 FredContent2 FredContent3 Jim JimsContent
Nothing database-driven about that.
See below... ...
I want to produce a home-page on my site using a URL like :
http://www.zope.org/Members/Fred
I'm a little confused as to how I would go about this in a dynamic way where I would pull the contents of the page out of a database.
A non-database way would be to :
/Members (folder) /Fred (sub-folder or Document) /Jim (sub-folder or Document) /Jane (sub-folder or Document)
But I want to be able to generate the /Members/Fred page dynamically.
What exactly would you generate this off of? I would guess from data in a databse (SQL)? If so, you could do a select statement to ge tthe userlist. You would then make a 'template' that built a page from the data in a database, where username==username (ie Fred). But, you could be asking for something completely different. ;) _______________________________________________ Zope maillist - Zope@zope.org 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 )
Ian, Make "Members" a DTML Method and inside that method you call a ZSQL Method (made previously) that takes the parameter of 'userid=name'. Store the name of the member in the cookie and when the visit /members/ or /members/name it gets all the data from the SQL Database and publishes it any way you want. Build any other functionality in the "Members" DTML Method to allow for /members/name/preferences or any other parameter you want to pass it. Just pick it up in an DTML-IF statement and do the rest. Good luck. J
The thought I had was that "Members" could be a SQL method which takes "username" as a parameter, Ian then is passed in as that Username and the necessary data is pulled from the DB. This is fine except that I still need some other method to render the HTML page for delivery to the user and this would extend my url to : www.mysite.com/Members/Ian/rendermethod.
The other problem with this is that it clutters the root with the Members SQLMethod and the rendermethod DTML document. I might start adding more URL's like : www.mysite.com/Members/Ian/preferences or www.mysite.com/Members/Ian/pastposts and the "preferences" and "pastposts" documents would end up in the root too. All these things belong in a Members folder, not at the root.
I'm missing something important, I'd appreciate any enlightenment you could bring to this.
- Ian.
participants (4)
-
Bill Anderson -
Ian Sparks -
J. Atwood -
Philipp Dunkel