[Simplecms-development] Re: Database Layout
Brought to you by:
mexi1010,
swivelgames
From: Jonathan C. <jon...@gm...> - 2005-04-02 04:15:51
|
No, i'm not planning to make a wiki... although the way it is set up, one= =20 can easily allow everyone to edit the contents and the system to act like a= =20 wiki... I'm sorry for not laying out the design scheme clearly... The reason why I= =20 wrote the database scheme cuz I was running into road blocks as to exactly= =20 what would plug into where... I will try to explain what I have so far, but= =20 it is still very sketchy... (i'll release a full documentation when I finis= h=20 it) So far, I plan to have the content management system be a system of severa= l=20 "core" modules, and a lot of extra modules. I will explain the definition o= f=20 modules as I go on... The layout will be all virtual, using multiviews or mod_rewrite... For my= =20 example, I will be using mod_rewrite to rewrite all queries to=20 http://example.com/index.php?$QUERY... Let's say somebody goes to the page= =20 http://example.com/news/BoyEatsElephant?comments... SimpleCMS will be given= =20 http://example.com/index.php?news/BoyEatsElephant?comments. The first thing= =20 SimpleCMS will load is load the ParseURI module... This is the first of=20 SimpleCMS's "core" modules. This module (which i finished writing) reads th= e=20 URI and passes the intended URI (news/BoyEatsElephant) and the arguments=20 passed after the "?" to the rest of the system. $_GET variable will not=20 work, because it is already being used for the URI, especially if we're=20 using mod_rewrite so this ParseURI module is necessary. ParseURI also turns= =20 all variables set as foo=3Dbar seperated by "&" into into an array (ie.=20 http://example.com/test?foo=3Dbar&test=3Dtrue)...=20 The next module that is run is the uri_handler module. This module takes= =20 the uri given from the ParseURI module and determines which "page" should b= e=20 loaded. I have this crazy idea of having all the pages in a hiarchy scheme.= =20 Example: news news/foo news/bar news/test news/test/help My only problem is that this could degrade performance, but it would allow= =20 for automatic creation of navigation menus. If every page has some relation= =20 to another page, then we can just call all pages from $ParentID and get a= =20 navigation menu... In any case, if someone did not like this method, they= =20 could just replace this module. If performance is bad enough, I may just=20 write 2 different modules for this, one with the hiarchy system and one wit= h=20 just a direct URI. One of the beauties of a totally modular system. After the uri_handler is run, the core module "global module handler" (i= =20 haven't had a chance to give it a good name, if you can suggest one, i'd be= =20 very happy) is runned. The "global module handler" loads the "global"=20 modules, modules that run on every single page and could be as simple as=20 header modules (to place data before the content) or as complicated as=20 session modules to handle the user session... In this aspect, yes, my=20 definition of modules is snippets of code. But i don't want it to be just= =20 any code that gets thrown in. I would like to write a documentation=20 requiring modules to be either in OOP using standard calls, or written as= =20 several functions with standard names. In any case, the pre-content=20 functions are called, then the content is loaded. This is where I want to insert my second form of modules, "user" modules.= =20 These modules will be installed before use and will be called only on=20 individual pages by special tags <{}> or something. I'd like to see the=20 editor only have to type <{date}> and the date module be ran and replace th= e=20 <{date}> tag. I plan to use a regex search and search through the content= =20 field for all these tags and replace them with the output of the "user"=20 modules...=20 After all the tags have been replaced with modules, and the contents=20 loaded.. One last pass of "post-content" global modules are loaded... I nee= d=20 to think up of a name to call the "pre-page" and "post-page" global module= =20 functions. After this, the last "core" module is runned, the template module. Up to= =20 this time, all the content has not been displayed to the user. It has lay= =20 dormant as a $variable (probably $content). I have added another section to= =20 the Content table, "template". If set to 0, the content is displayed withou= t=20 a template, if set to a number, it uses the template of the $templateID=20 (which is another table I have added since the last email).... Of course,= =20 this module uses Smarty Templating system... I might throw in "template"=20 modules, not sure yet... haven't looked too much at this yet... I hope I have clearly layed out to you my design of the system. I'll=20 summerize once more. http://example.com/news/BoyEatsElephant?comment&page=3D2 / |-- ParseURI Reads the URI | $uri->URI =3D news/BoyEatsElephant | $uri->Args =3D comment&page=3D2 | $uri->arg =3D array... $uri->arg['comment'] =3D null; $uri->arg['page']= =3D2 |-- URI_Handler reads $uri->URI and finds it is an article under 'news';= =20 ParentID set... |-- Modules Handler/Content Handler loads "pre-page" global modules=20 functions... | *Example Global Modules:* | header module is loaded... $content .=3D date() etc. etc. | session module is loaded, sessions/cookies are loaded | |-- Content Handler/User Module Handler is loaded and searches for=20 <{usermodules}> | *Example User Modules: * | <{time}> inserts time here... | <{comment}> comment's module inserts page 2 of comments where this tag= =20 is... |=20 | After all user modules is found and replaced, $content .=3D=20 content->loadcontent()=20 | or something like that... i haven't gotten here yet. | |-- Module Handler/Content Handler loads "post-page" global module=20 functions \__Template Module is loaded, and page is spit out with or without a=20 template. So I had to write a rough draft sketch of the database design... What I= =20 have so far is 3 module models, maybe 4... "Core" modules, which the both= =20 the user and developer shouldn't need to change, the "global" modules, whic= h=20 developers can create modules for, and the "user" modules, which users can= =20 insert into the contents... I'm planning to have the admin interface as a= =20 module too.=20 Tell me what you think of the design... I tried to make this system as=20 editable as possible so there is no need to "hack". I don't think there is= =20 anywhere else that you would need to insert code that i haven't allowed cod= e=20 to be inserted... Jonathan Chan =20 > [off-topic] > I agree with the ACL. Though looking at the levels you talk about I"m > not quite sure about the overall layout of the engine you"re planning, > specially the level 100, sounds more like a wiki to me. > So, what seems to me is that when you speak of modules are you in fact > speaking of tiny snippets, and all content will be handled by a unique > component. Am I right? I thought more a phpnuke-like design so this > would change a lot of my assumptions. Please, clarify this point. >=20 > To put it with an example: > So, would http://example.com/whatever access the whatever content > page, handled by a "content" module, or would it access the whatever > module? >=20 > I believe planning first the architecture and/or classes > hierarchy/relations would be better. >=20 > [on-DB-topic] > * Anyway, the content table should have a string index if you plan to > have nice urls. If this voids the need or not of a contentID will > depend, but you most certainly want a string index whatsoever. >=20 > * Also you may want an "enabled" field on the content table too. >=20 > I would have more comments but I must first understand better the > design details. > |