dbo Posted August 21, 2007 Share Posted August 21, 2007 From an implementation standpoint how can you truly seperate content from design? Quote Link to comment Share on other sites More sharing options...
Eric_Ryk Posted August 21, 2007 Share Posted August 21, 2007 Define "design." Quote Link to comment Share on other sites More sharing options...
steelmanronald06 Posted August 21, 2007 Share Posted August 21, 2007 if you mean design as in pure html and content as in php then you should check out Smarty. (smarty.php.net) Quote Link to comment Share on other sites More sharing options...
dbo Posted August 21, 2007 Author Share Posted August 21, 2007 By design I mean the physical display/layout on the page once it has been rendered. Smarty doesn't really seperate it though does it? It's just a templating system that let's you apply styles to "blocks" of content? Or am I way off here? Quote Link to comment Share on other sites More sharing options...
steelmanronald06 Posted August 21, 2007 Share Posted August 21, 2007 smarty keeps your php code and your layout seperate. cakephp does something similar to that. Quote Link to comment Share on other sites More sharing options...
dbo Posted August 21, 2007 Author Share Posted August 21, 2007 Never used smarty... only familiar with the idea of it conceptually. I just did some looking at their site. As clear as I can tell the process is this (please correct me). 1) Developer writes php code that makes up application logic. This includes a smarty object where I "define" variables that should be output. 2) Designer creates templates that use the appropriate variables as defined by smart. 3) At runtime smarty engine replaces the place holders with the the actual values and serves the page. In a nutshell is that basically how it works? I also see that it says you can put logic specific to design in a template file? Is there a special syntax for this or just normal PHP code? I'll be investigating it further. Thanks for the tip. Quote Link to comment Share on other sites More sharing options...
dbo Posted August 21, 2007 Author Share Posted August 21, 2007 Nope it has its own generic scripting syntax. Quote Link to comment Share on other sites More sharing options...
redbullmarky Posted August 21, 2007 Share Posted August 21, 2007 there's a difference between display (presentation) logic and business logic, which many get confused when the idea of seperation comes up. it's perfectly acceptable (and pretty much essential) to put some sort of code in your templates, no matter how you want to butter it up and pretend it's not code. but just stick to the absolute basics - loops, echos, etc and nothing that handles the running of the app itself such as DB calls, etc. PHP: <?=$name ?> SMARTY: {name] not much difference, is there?....dont be fooled into thinking smarty is gonna completely seperate this out for you. Quote Link to comment Share on other sites More sharing options...
dbo Posted August 21, 2007 Author Share Posted August 21, 2007 Oh I'm not. Quote Link to comment Share on other sites More sharing options...
Eric_Ryk Posted August 21, 2007 Share Posted August 21, 2007 Well by the layout, that would essentially be the different views. The content, in my opinion, would be the equivalent of the different models that you might have stored on file or in database; either way it doesn't really matter. The separation comes about in using the very place holders talked about previously. Rather than having the actual content in the view defined, ie: <b>Hello world.</b> You could do: <b><?php echo $content; ?></b> Generally speaking, in a well-formed implementation, the views are stored in separate files than the logic and more complicated programming. Correct me if I'm misinterpreting this question. Quote Link to comment Share on other sites More sharing options...
dbo Posted August 21, 2007 Author Share Posted August 21, 2007 I appreciate the responses. I'm not necessarily going to use smarty. I think it has some good principles behind it but I'm more concerned with the approach and process right now. Ultimately what I'm trying to do is create a framework that will enable me to rapidly write applications that sort of overlays with my own development methodology. There are some good frameworks and CMS out there but they sort of force you to do it their way and also generally have a much larger footprint than I'm interested in working on. In addition to really get the effect I want I'd have to pull smarty and a framework such as cakephp or zend to even come close to what I'm thinking. Anyways it's just me ranting. At the end of the day standardization is going to make my life a lot better. It makes it easy for me to push out upgrades to clients and take on a larger magnitude of opportunities because I'm doing everything from the same base layer of classes. To an extent I do this today but no where near where I need to be. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.