Jump to content

Recommended Posts

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.

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.

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.

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.