
terrill
User
Aug 6, 2002, 7:05 AM
Post #1 of 1
(1326 views)
Shortcut
|
|
Directory/Category/Subcategory Theory
|
Can't Post
|
|
Dave, Thought I'd move this into the forums, where more people could scrutinize the idea. I've seen/read several other messages requesting something similar. The thoughts, table structures, etc are not totally complete for an implementation, but a presentation of how things might work, only! Assumptions: * Examples are for Unix/Linux. MSDOS has equivilents, but of course! * RDBMS uses % as "Any characters," and ? as "single character" placeholders.
-- DIRECTORY STRUCTURE / CATEGORIES -- The Administrator identifies the publish directory: /home/www/ Admin creates the following directories under the publishing directory: /home/www/news /home/www//news/local /home/www/news/national /home/www/weather /home/www/weather/local /home/www/weather/national Artman (hereafter AM) automatically creates the categories: news news-local news-national weather weather-local weather-national AM publishes all stories for each category under their respective directories. --- RDBMS --- Trying to keep the "Relational" down to a useable minimum for these examples, a Relational structure might be: Relation: cats (categories, not the feline!) Attributes: catid (Primary Key) catname (category name) artcnt (article count) Relation: arts (not the 'liberal' kind) Attributes: artid (Primary Key) catid (Foreign Key) pubdate (publishing date) cntid (count for this item) base (subject base) topic (any questions?) headline (ditto) stext (story text) authid (author id (who done it?)) apprvid (who authorized publishing)
AM would insert the following Tuples into the cats Relation for the above category examples: insert into cats values(0,'news', 0); insert into cats values(1,'news/local, 0); insert into cats values(2,'news/national', 0); insert into cats values(3,'weather', 0); insert into cats values(4,'weather/local', 0); Note: slash used as category seperator, making Perl code a bit easier for making/changing directories. Since Larry forced the boys and girls to "standardize" all Perl ports, it'll work reguardless of what OS is hosting AM. --- ARTICLES --- We'll deal with two article examples: two hurricanes in 1995 and 2001, named "Billy-Joe-Bob" and "Abby." The writer chooses a category. E.G. "Weather-Local" and "weather-national" respectively. The writer will enter a "Base" subject, E.G. "hurricane" for both (If the users developed a naming convention, the retreval of stories could be made eaiser.) The writer will enter a Topic. E.G. "Billy-Joe-Bob" and "Abby." The writer enters a story headline. You figure this one out for the examples, OK? When AM creates the stories, it uses the current item count for each category (and increases it for the next one), and creates files named: /home/www/weather/local/020731_00000.html And /home/www/weather/national/020731_00000.html Note built-in article sorting naming convention using YYMMDD_NNNNN format, where NNNNN is the item count for that particular category. --- ARTICLE RETREVAL --- To get articles using SQL, we could find articles using syntax such as (and we'll only pull an article and not worry about the join to cats): select artid, catid, pubdate, cntid, headline from arts where base like 'hurr%'; The above would retrieve articles on both (all) hurricanes. Using the category id (after the join), publishing date and count id, the complete path and filename can easily be generated. Naming conventions lead to easy retrieval of articles by category, subcat, date, article sequence, topic, author, etc. Uh, with well deserved thanks to Dr. Codd. --- BENEFITS --- 1. Direct relationship between file structure and categories. Makes for easier understanding between the OS Administrator, writers, AM Admins etc. 2. Potentially easier conversion of existing sites into AM. 3. Unique, sortable, calculatable (is that a word?) filenames and paths. 4. Easy retrieval of data not only by AM, but external client programs. Ok, so it's a bit long. But, did ya expect anything less? I actually had something like this working with mSQL (sic), but gave-up the struggle when I paid someone else to manage my site (i.e. Artman)!-) Enjoy! -- Terrill --
"Evaporating expectations of quality: 1980's paradigm: If it's worth implementing once, it's worth implementing twice. 1990's paradigm: Ship the prototype! 2000's paradigm: Ship the idea!" ---Larry Rosler: http://www.perl.com/pub/a/2000/06/rosler.html
(This post was edited by terrill on Aug 6, 2002, 7:15 AM)
|