From: Jeff D. <da...@da...> - 2000-07-05 21:44:27
|
In message <146...@da...>,Arno Hollosi writes: >Here are some thoughts/questions: > >- the db interface will become very large. I realized that when I > added functions for MostPopular. For every such query we need > two new functions. I don't like this. I agree. > Possible solution: all search functions return a $pagehash array. > For some searches the hash may only be sparsely populated, e.g. > when doing a title or mostpopular search, it's unnecessary to > set $pagehash['content']. I think this is basically the right idea. Now I will let me bias towards classes run free: This is where (at least the way I see it) making $pagehash into a class (concrete type) would make things cleaner. $pagehash['content'] turns into $page-> content() which can do something smart (either signal error, or fetch the content) if the content isn't there. > There could be one general NextMatch function in this case. > For the DBM interface that might be impossible - maybe that function > has to have a switch() structure of some kind. The db search/scan functions should return some kind of iterator. For example, some usage like: $hotlist = FindMostPopular($dbi, $limit); // Better yet: $hotlist = $dbi->FindMostPopular($limit); :-) while ($page = $hotlist->next()) echo $page->pagename() . " " . $page->hitcount() . "hits\n"; >- template facility: > A template class that does the translation from $content to $html. > Placeholder objects register with that class, and then get called > from there. Excellent! Some way to get arguments to placeholders would be nice as well. For example, currently the ###IFCOPY### placeholder has as its argument the remainder of the line --- however this is clumsy. As another example, it would be nice to have an "###INCLUDE###" placeholder (taking a file name as an argument) that could be used to suck in a sub-template. Jeff |