[pmwiki-users] PageLists of database contents
Pico
pmwiki at ben-amotz.com
Wed Oct 4 16:24:25 CDT 2006
> From: Ben Stallings <Ben at InterdependentWeb.com>
> Patrick R. Michaud wrote:
> > 1. Create a custom PageStore object that converts database records
> > into (virtual) pages. In other words, when some function calls
> > ReadPage('DataBase.RecordId'), the custom PageStore object should
> > return the equivalent of a page where $page['text'] is:
> >
> > (:Field1:Value:)
> > (:Field2:Value:)
> > (:Field3:Value:)
> >
> > Once you have that, then (:pagelist:) should be able to do a
> > variety of searches and sorts based on the records in the database,
> > and use custom pagelist templates for the output. (Hint: the
> > PageStore object will need to implement the read(), ls(), and
> > exists() methods.)
>
> Success! I've got a new DataStore object (based on PageStore) that
> supports the read, ls, and exists methods, and I've added it to the
> $WikiLibDirs, so that if you go to
> http://www.workscited.net/ben/Source/Source you will see (after a long
> delay) a pagelist of records in the `source` table of the WorksCited.net
> database. Note that this page (Source/Source) does not exist; it's
> being generated by the DataStore object.
Congratulations!
>
> If you click one of the "pages" in that list, you won't see anything
> because there's not yet a template to display the data, but if you
> *edit* one of them, for example
> http://www.workscited.net/ben/Source/12?action=edit , you'll see that
> the data fields are defined as Pm specified above. (Don't try to save
> changes, though; I haven't gotten to that yet.)
>
AFAIK, isn't the reason we aren't seeing anything because you are using
the directive form of page text variables (as Pm suggested). I'm not
questioning that decision, but I think that if you used the standard
forms (either a definition list :term:definition or the new form of
term:definition) then you would see all of the fields and assigned
values in the view mode. (Or am I missing something here?).
> So that much is good. However, I could use some help with a few
> things... sorry to be pesky.
>
> First and most obviously, this is extremely slow and inefficient on even
> a modest-size database. The ls() method generates a list of every
> single record in every table of the database, and then PageList calls
> the read() method to individually query each record and gloms its fields
> together into a big block of text before attempting to parse the text
> back up again into page text variables. There's gotta be a better way,
> but I'm not sure what it is... I want to be able to use PageList's
> powerful searching syntax and templates, but without the overhead of
> converting every single record into text and back again. Suggestions?
>
> Second, if you try searching the Source group at
> http://www.workscited.net/ben/Site/Search , it doesn't appear to search
> page text variables... which was the whole point of putting the records
> in that format. For example, search for $:firstname=Will. No dice,
> although you can see by clicking the editing link above that record 12's
> firstname is Will. I'm using 2.0.0-beta-9. Ideas?
>
> Thanks again!! I really believe this will be worth the trouble... --Ben S.
>
Thank you.
Pico
More information about the pmwiki-users
mailing list