Chapter 3. What Designers Need to Know

In the previous chapters you learned about the basic concepts and setting up of Smarty. As a Smarty developer, you have to understand some basic procedures and know how. This chapter will guide you through the necessary steps to kick start template designing. Before starting template design, you should always be aware of the main objective of Smarty. Let me repeat again for you that the main goal of Smarty is to separate the presentation layer from business logic. This chapter will show you the best way to develop templates while keeping this goal in perspective, and at the same time satisfying your programmers, helping you to co-operate with them, minimizing their task, and increasing the reusability of your final output.

One more thing you should be aware of is that you shouldn’t mix up identities. Most often, the designers are to some extent programmers and vice versa. While designing you must totally forget that you are also a programmer and look at things only from a designer’s perspective. If you mix up your identities, there will be a great risk of non-standard designs.

Development Team Problems: Common Scenarios

Do you remember those days when you hard coded your business logic into your HTML pages? To some developers, this embedding capability brought an extra level of satisfaction. You designed (let’s read hard coded—we are still in your old days) a lot of pages for your extremely beautiful site and delivered it to the customer. Only to be faced with problems when even a small change needed to be made to the site. Now let’s look at common problems faced during those days by designers, managers, and developers, and their possible solutions (with and without Smarty):

  • Designer’s Problem:
    • Problem: After using your solution for some days, the customer requires a small change in site layout. The change is required within a very short time and there is no way you can extend the deadline or avoid it.
    • Solution without using Smarty: In this situation, you will go to your desk, won’t sleep for some nights and will change all those hard-coded pages by manually modifying them one by one. Are you scared that something similar might happen again? Undoubtedly, you are. Maybe you could tackle it this time, but when you have hundreds of such pages, it will be very different.
    • Solution using Smarty: Open your Smarty templates, perform the necessary change, and upload it to your server. You don’t have to worry about processed data and business logic. Moreover, you needn’t worry about searching through a lot of gibberish code and spending a lot of time and effort changing it.
  • Manager/Developer’s Problem:
    • Problem: You are the manager of this company. You need to modify your existing site’s appearance and suddenly you find that the programmer who hard coded this site has quit a few days ago.
    • Solution without using Smarty: You will hire another programmer who will read the previous code, figure out the portions to change and then make the changes. It may sound easy but actually, it’s not. Reading code written by another programmer is a very tough job. Furthermore, if your previous programmer didn’t document the coding, it will create bigger complications.
    • Solution using Smarty: Ask your Smarty template designer to perform necessary changes and save it. There is a chance that you may not even need to look at your inner business logic and codes.

Do these scenarios make any sense to you? Well, these two scenarios are enough to illustrate the situation of a designer and a manager. Which one do you relate to? This chapter and the upcoming chapters will help you to solve problems like these in a more effective way by using the Smarty templating engine.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.2.15