On Sat, 2004-01-24 at 01:53, Hamid Hossain wrote: > Hi, > > Always I have a problem that I don't know how to make my code away from the > user interface files. > > I tried to use some template classes, but I did'nt like what I tired because > some if statments are used inside the template. > > How can I prepare my code to be working in more that one template? Should I > use some methodology like FuseBox.org
A common misconception is that templates provide complete separation from logic, this is untrue. Template frameworks (the best ones) provide separation of business logic from presentation logic. So using an "if" statement inside a template is completely normal if it pertains to the display logic. So for instance the following is generally valid in a template (using InterJinn's syntax since I'm writing this :): <jinn:if name="userSummary" test="{jinn:getValue name=loginStatus}"> <p class="userSummary"> Display information about the user in some template formatted fashion that will only be displayed if the user is logged in.</p> </jinn:if> Whereas something like the following would not be appropriate template logic: <notjinn:setValue name="timeLeft" expr="($age + 3) / 2" /> <jinn:echo value="{jinn:getValue name=timeLeft}" /> Since th calculation for timeLeft would almost certainly be business logic. HTH, Rob. -- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php