From: Alain F. <al...@va...> - 2001-03-29 15:04:51
|
Hello, I wonder why all the talking about "storing templates in the database" comes from; I surely hope it isn't because I somehow mentioned the idea in one of my previous posts.. :) As a matter of fact, it would be pretty stupid to store the whole template in the database. Why? Because that's not what databases are for. Let me explain: how many times will phpWebSite need to run "typical database functions" on the templates themselves, like: finding a text in the template, creating the "sum of all templates", finding a "template's detail", and so on ? Never, right. It's exactly the same story as with images. Although you can store the whole binary stream of an image into mySQL, there's very little or absolutely no sense in doing so. Storing the template's filename is indeed what is needed. Anyway, as Todd says, you will get far better performance by using the filesystem for this. And it's not only about performance, it's also easier to manage the templates when they are simple text files. Using a browser-based interface to change the styles is indeed a cool idea. Oh wait, wasn't it me who initially suggested that ? hehe :)). Seriously, it wouldn't be too hard to integrate it. A little brainstorming if you permit: 1. Ideally, all styles would need to be stored in one single .css file. That makes management and automation easier. Let's call it theme.css. The real filename would actually be theme.css.php because the styles would be defined dynamically through PHP and database calls. 2. Every style (ID, tag overload, or class) that is used in phpWebSite would need to be defined in that file. 3. The admin interface should have a "preview style" feature so that one can check the result immediately. 4. One should be able to define more than one theme. This means that we'd need a "themes" table, and a "themesdetail" table that defines the values for the individual styles, per theme. 5. It would be nice if the advanced user would not be limited to using the admin interface. The advanced user should be able to manually apply his hand-crafted .css file. 6. How do we go about defining a style's values? The problem is that you can have a varying number of style attributes. A ".bigTitle" CSS class can have a single "font-size" attribute, or it can have a dozen attributes: font-family, font-size, color, margin-left, and so on. There are a couple of possibilities. The first one is the easy one. For every style used, -we- define the attributes that can be edited through the admin interface. For instance, we define that for the .bigTitle class, only font-color and font-family can be set using the tool. The second possibility would be to create a complete CSS editor, allowing the site administrator to dynamically add, edit and remove style attributes. Then again, either we assume that the site admin has good CSS knowledge and knows what he is doing, OR we create a "user assisting" interface that shows the site administrator what attributes are available for this or that class, and what values this or that attribute can have. You see, this completely dynamic version would certainly require a -lot- of work and come pretty close to a full-featured CSS editor, because we'd somehow need to classify the various styles so that the 'system' knows what atributes and values are available. 7. If we are going to make it as dynamic: how about performance? We'd need to investigate caching/compiling options. 8. Also, having that degree of "dynamicity" (?) would allow us to make a very customizable phpWebSite in which the site visitor could create his own style sheet definitions ! 9. For every style definition, the editor should show where a particular style is used, so that the user immediately sees at what places his changes are going to have an effect. It's a PITA to edit a style for one place just to find out that the very same style is used on 5 other pages, and messes everything up on those. Okay, enough for now. Waiting for comments/suggestions/ideas :) > -----Message d'origine----- > De : php...@li... > [mailto:php...@li...]De la part de > Todd Owen > Envoyé : jeudi 29 mars 2001 16:31 > À : php...@li... > Objet : Re: [Phpwebsite-developers] Template system (Smarty) > > > Karsten, that was exactly what I was talking about ! I agree that the > templates and style sheets (generically called themes) should be stored in > the filesystem and not in the database for performance issues. An browser > based form to edit the style sheets also makes sense and avoid uploading. > > --Todd > > > > _______________________________________________ > Phpwebsite-developers mailing list > Php...@li... > http://lists.sourceforge.net/lists/listinfo/phpwebsite-developers > > |