Re: [PHP] Using templates (Code & User Interface)

2004-01-25 Thread rush
"Robert Cummings" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> 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.

My opinon on that is that template system role is to separate presentation
logic from the html which can be considered as resource. Therefore I do not
prefer template systems with embeded control structures in it. But I guess
it is a matter of ones own preferences, and what is "right approach" for
them it is not necessary right for me and other way around.

I completely agree that it is also necessary to separate bussines logic from
the presentation, but I do not think this is a job of template system.

rush
--
http://www.templatetamer.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Using templates (Code & User Interface)

2004-01-24 Thread -{ Rene Brehmer }-
I wrote my own template system that works very well... I've got an outer
control file that handles the user input, sets the variables for what the
template should use of stylesheets and menus and such, and a variable for
what body to use. All my body files are either PHP programs in themselves
mixed with HTML presentation (I try to keep near all the PHP in the start,
and the actual presentation generation at the end).

Basically it means that the template only holds the basic table structure of
the site, and a little code to include the files that are needed to make it
into what it's suppose to look like.

The way I made it I can use the same template file all over the site, or
make another template and tell the control scripts to use that instead. I
still haven't made it possible for the menu system to change looks though,
but I plan to add that in the future...

It would be very easy to change my system to allow it to use different
templates or other elements based on various conditions

FWIW

Rene

Fate would have it, that on Sat, 24 Jan 2004 09:53:16 +0300, 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
>
>Regards,
>Hamid Hossain

-- 
Rene Brehmer
aka Metalbunny

http://metalbunny.net/
References, tools, and other useful stuff...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Using templates (Code & User Interface)

2004-01-24 Thread Robert Cummings
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 :):


 Display information about the user in
some template formatted fashion that will only be displayed if
the user is logged in.


Whereas something like the following would not be appropriate template
logic:




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



[PHP] Using templates (Code & User Interface)

2004-01-23 Thread Hamid Hossain
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

Regards,
Hamid Hossain
_
The new MSN 8: advanced junk mail protection and 2 months FREE* 
http://join.msn.com/?page=features/junkmail

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php