RE: [PHP] Seperating presentation from logic

2002-06-27 Thread SP

I can only talk about smarty but the designers can use as little or as much
of the features in the template.  For example:

Typing {$app_version} in an ordinary html file could display "Greatest
Application version 3.3".  If your programmer changes the value to "Greatest
Application version 4.0", the designer doesn't have to do anything. It would
show up automatically

This is a simple idea but what if you want to support multiple languages.
You tell your designer, use this tag for the welcome message {$welcome_user}
and if the user chooses english the message will come up like this "Welcome
Mark" and if the user chooses french then it will come up like this "Bonjour
Mark".

Smarty also has a bunch of tags like {html_select_date start_year=1998
end_year=2010} which would spit out a pulldown menu of all the months, a
pulldown menu of all the days, and a pulldown menu of all the years from
1998 to 2010.

You could create your own tags too like {display_all_users_online} and it
would spit out all the users online.  Or you could create a tag like
{diplay_calender bg=blue text=black} and it would spit out a calender table
with a blue background and black text.

I'm sure those tags I showed you aren't hard to grasp, you can make it
harder with smarty cuz it has if/else and loop tags too but that's for more
advanced designers.



-Original Message-
From: Jesper Brunholm [mailto:[EMAIL PROTECTED]]
Sent: June 27, 2002 7:40 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Seperating presentation from logic


John Holmes wrote:
> You really want a template system. Check out Smarty or patTemplate.
> Devshed.com has a nice two part tutorial on patTemplate and I like how
> it looks a little better than Smarty right now. Might want to evaluate
> both and see which is faster or easier.

Great idea - except that... when you've taught your designer to use the
template system you've ofte used about the amount of time it would take
to give him enough knowledge about php to go directly into the code the
way that Freeman suggested...

Regards

Jesper Brunholm

--
Phønix - Danish folk music from young musicians - http://www.phonixfolk.dk



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




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




Re: [PHP] Seperating presentation from logic

2002-06-27 Thread Jesper Brunholm

John Holmes wrote:
> You really want a template system. Check out Smarty or patTemplate.
> Devshed.com has a nice two part tutorial on patTemplate and I like how
> it looks a little better than Smarty right now. Might want to evaluate
> both and see which is faster or easier. 

Great idea - except that... when you've taught your designer to use the 
template system you've ofte used about the amount of time it would take 
to give him enough knowledge about php to go directly into the code the 
way that Freeman suggested...

Regards

Jesper Brunholm

-- 
Phønix - Danish folk music from young musicians - http://www.phonixfolk.dk



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




RE: [PHP] Seperating presentation from logic

2002-06-27 Thread SP

Very cool John, you should forward that to pattemplate and they could see
what to improve.  One thing they could do is just implement caching like
smarty templates does and you can't beat servering up static files.


-Original Message-
From: John Holmes [mailto:[EMAIL PROTECTED]]
Sent: June 27, 2002 12:39 AM
To: 'SP'; 'Jean-Christian Imbeault'; [EMAIL PROTECTED]
Subject: RE: [PHP] Seperating presentation from logic


> There are a ton of template systems.  Look here for performance
> benchmarks:
> http://www.phpinsider.com/benchmarks_phemplate
>
> Unfortunately pattemplate isn't tested so I don't know how it rates.

I downloaded the scripts and added patTemplate to the mix. It's average,
rating in the middle on most tests...

The big thing to notice is the last test, which runs through 100 loops
on a test file. Smarty just blows everything out of the water. And think
about what most of your web pages do...loop through result sets.

If anyone wants the files, let me know. It's a simple unzip and run,
everything is all packaged together. Results may vary on different
servers; I'd like to see a *nix/Apache result set posted...

Tested on Win2K / 1Ghz AMD / 512MB RAM / IIS 5.0 / PHP 4.2.1 (ISAPI
Module), YRMV

---John Holmes...

TEST 1.1 :: 20 registered vars :: 10 iterations
name/ total time / average iteration time
100% smarty 4ms 0.0040654
103% phemplate  4ms 0.0041828
147% heyes class6ms 0.0059759
157% XTemplate  6ms 0.006363
160% phplib tpl 7ms 0.006502
256% bugi   10ms 0.0104083
290% patTemplate12ms 0.0117798
388% vTemplate  16ms 0.0157634
439% TemplatePower v2   18ms 0.0178361
1350% FastTemplate  55ms 0.0548866

TEST 1.2 :: 5 registered vars :: 10 iterations
name / total time / average iteration time
100% heyes class3ms 0.0032871
106% phemplate  3ms 0.0034916
139% phplib tpl 5ms 0.0045691
148% smarty 5ms 0.0048685
160% XTemplate  5ms 0.0052609
257% FastTemplate   8ms 0.0084631
307% bugi   10ms 0.010094
332% patTemplate11ms 0.0109147
448% TemplatePower v2   15ms 0.0147268
502% vTemplate  16ms 0.0164906

TEST 1.3 :: 40 registered vars :: 5 iterations
name / total time / average iteration time
100% phemplate  2ms 0.00453
141% smarty 3ms 0.0064098
159% XTemplate  4ms 0.0072178
178% phplib tpl 4ms 0.0080422
206% heyes class5ms 0.0093244
262% bugi   6ms 0.0118796
353% TemplatePower v2   8ms 0.015982
368% patTemplate8ms 0.0166856
401% vTemplate  9ms 0.0181768
1329% FastTemplate  30ms 0.0602032

TEST 2.1 :: text 10kb // loop 100 records // 10 iterations
name / total time / average iteration time
100% smarty 6ms 0.0055744
379% phemplate  21ms 0.0211018
1039% bugi  58ms 0.0579146
1344% TemplatePower v2  75ms 0.0749261
1360% patTemplate   76ms 0.075819
3283% phplib tpl183ms 0.182
7096% XTemplate 396ms 0.3955393
8324% heyes class   464ms 0.4640006


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




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




RE: [PHP] Seperating presentation from logic

2002-06-26 Thread John Holmes

> There are a ton of template systems.  Look here for performance
> benchmarks:
> http://www.phpinsider.com/benchmarks_phemplate
> 
> Unfortunately pattemplate isn't tested so I don't know how it rates.

I downloaded the scripts and added patTemplate to the mix. It's average,
rating in the middle on most tests...

The big thing to notice is the last test, which runs through 100 loops
on a test file. Smarty just blows everything out of the water. And think
about what most of your web pages do...loop through result sets.

If anyone wants the files, let me know. It's a simple unzip and run,
everything is all packaged together. Results may vary on different
servers; I'd like to see a *nix/Apache result set posted...

Tested on Win2K / 1Ghz AMD / 512MB RAM / IIS 5.0 / PHP 4.2.1 (ISAPI
Module), YRMV

---John Holmes...

TEST 1.1 :: 20 registered vars :: 10 iterations 
name/ total time / average iteration time  
100% smarty 4ms 0.0040654  
103% phemplate  4ms 0.0041828  
147% heyes class6ms 0.0059759  
157% XTemplate  6ms 0.006363  
160% phplib tpl 7ms 0.006502  
256% bugi   10ms 0.0104083  
290% patTemplate12ms 0.0117798  
388% vTemplate  16ms 0.0157634  
439% TemplatePower v2   18ms 0.0178361  
1350% FastTemplate  55ms 0.0548866  

TEST 1.2 :: 5 registered vars :: 10 iterations 
name / total time / average iteration time  
100% heyes class3ms 0.0032871  
106% phemplate  3ms 0.0034916  
139% phplib tpl 5ms 0.0045691  
148% smarty 5ms 0.0048685  
160% XTemplate  5ms 0.0052609  
257% FastTemplate   8ms 0.0084631  
307% bugi   10ms 0.010094  
332% patTemplate11ms 0.0109147  
448% TemplatePower v2   15ms 0.0147268  
502% vTemplate  16ms 0.0164906  

TEST 1.3 :: 40 registered vars :: 5 iterations 
name / total time / average iteration time  
100% phemplate  2ms 0.00453  
141% smarty 3ms 0.0064098  
159% XTemplate  4ms 0.0072178  
178% phplib tpl 4ms 0.0080422  
206% heyes class5ms 0.0093244  
262% bugi   6ms 0.0118796  
353% TemplatePower v2   8ms 0.015982  
368% patTemplate8ms 0.0166856  
401% vTemplate  9ms 0.0181768  
1329% FastTemplate  30ms 0.0602032  

TEST 2.1 :: text 10kb // loop 100 records // 10 iterations 
name / total time / average iteration time  
100% smarty 6ms 0.0055744  
379% phemplate  21ms 0.0211018  
1039% bugi  58ms 0.0579146  
1344% TemplatePower v2  75ms 0.0749261  
1360% patTemplate   76ms 0.075819  
3283% phplib tpl183ms 0.182  
7096% XTemplate 396ms 0.3955393  
8324% heyes class   464ms 0.4640006  


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




Re: [PHP] Seperating presentation from logic

2002-06-26 Thread Justin French

on 26/06/02 11:53 PM, Mark Gallagher ([EMAIL PROTECTED]) wrote:

> Theoretically this could still be done only with editing of the
> stylesheet.  Of course, it's not that simple - Mozilla comes closest to
> decent browser support for that sort of radical change, and even it's
> not there yet.

well, theories don't work for me or my clients just yet :)

i need proven methods.


> Actually, I think the idea behind what the previous poster was saying is
> that:
> a) with stylesheets they don't need to touch the HTML once they've
> finished with it (and handed it over to you for PHP work)
> b) you therefore won't need templates

I'm not convinced that:

a) the increased development time is worth the theoretical benefits

b) the lack of a boss, team leader or controller is such a good idea

c) EVERYTHING can be achieved


The idea that the designer and the programmer aren't even talking to each
other worries me... if the designer adds a HR class that he thinks is a good
idea, it may completely screw with everything else I've done.  Nuh-uh.

Designers should make recommendations to programmers in this case, and the
programmer should make certain variables / configuration options available
to the designer 24/7 for tweaking.


Furthermore, the idea of a style sheet replacing ALL design further down the
page is in fact a form of template.  Except with this template, everyone has
their fingers in the pie, which can't be a perfect solution.


To achieve this "no rules, designer can do what they want" methodology
would, IMO, lead to endless hours of development time, and then endless
hours of bug fixes and tracing down problems.  By inserting a few rules (
like "you only have a choice of 2 or 3 columns, not 1, not 4+") will make
the development time shorter, lead to less conflict, etc etc.

I'm not saying "don't use style sheets" -- because I do on every project!
I'm saying "don't give the style sheet to the designer" -- give them a
config file at best, or access to a small style sheet of things they NEED.


IMO of course :)

Justin French


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




Re: [PHP] Seperating presentation from logic

2002-06-26 Thread Peter J. Schoenster

On 25 Jun 2002 at 17:40, Jean-Christian Imbeault wrote:

> Some of the "issues" are things like how to make it painless for both
> the designers and me if one day, out of the blue, a designers decides
> that the background colour should be changed, or the graphics changed.
> Or even worse the two column layout should be a three column layout.
> 
> But to start off with simple things like:
> 
> Designer:
>  - on this page a dynamic table will be generated according to the
>  search 
> criteria entered by the user
>  - lines will have alternating colours
> 
> I can code this easily, but what if the designer then decides that he
> wants each *third* line to alternate colour, or he wants to use three
> colours instead of two (a pattern 1,2,3,1,2,3 instead of 1,2,1,2).
> 
> How can I make it so that he can do these changes without coming to
> see me to change the code that outputs the data used in the table?
> 
> Simple things like that ;)

There was a recent thread on the mod_perl list related to this concept: MVC. 

http://st-www.cs.uiuc.edu/users/smarch/st-docs/mvc.html

I have an image gallery app in Perl. There are controllers (cgi, mod_perl handler, 
script) which call functions in the "models" which simply or not perform functions and 
return data in hashes and 
arrays and arrays of hashes of arrays ... :)  then the controller calls the viewer 
it wants to use (works with HTML::Template or Template::Toolkit) and sends the results 
back to the client 
making the request (and depeneding on that client, one or other view would be used). I 
rebelled when my boss wanted me to write an app for a handheld ... oh sure ... I'll 
just cut and paste and 
... what a mess you will get into.  You can see that here:

http://www.memphisart.com/gallery/

I am in the process of applying some themes from this site:

http://www.oswd.org/

Takes about 10 minutes to 1 hour depending on how the theme is written.

The same concepts apply to PHP. I have 2 php sites and I've kind of tried to avoide a 
mishmash of html and PHP code all over the place. I used the concept of the Wrapper 
from 
Template::Toolkit for with a port of HTML::Template to PHP here:

http://www.coremodules.com/
http://www.coremodules.com/talent/index.php

A page calls which wrapper it wants to use. So in the case of talent it uses a one 
table body whereas most other pages use the 3 column wrapper.  The pages simply gather 
the content ... the 
design of the page (for the site as a whole therefore) is done in one location.

BUT, BUT ... now that I've seen this site:

http://www.interakt.ro/products/Krysalis/

I'm going to try and scrap my PHP hack above and use the above. I was never able to 
use cocoon because I always use virtual hosts. If I can get the above to work on my 
PHP sites then I 
might use PHP a lot more. I have a good Perl system but I've only played with PHP for 
now. Anyone can write the spagetti code which is 90% of what I see in PHP. Most Perl 
programmers I 
know write their own template system ... just a common sense sort of thing and usually 
it starts from ignorance of a good existing templating system ... I've worked at a few 
different companies 
and I much prefer to find code that follows a standard than code that follows the 
whims of the programmer who happened to string it all together.

Oh one more thing. The best projects I've worked on have an "html guy". This guy is in 
between a programmer and a designer.  We get the designer to do their stuff in 
photoshop or similar and 
the html guy converts that into the screen shots we need with our data model and 
template tags.   Of course most companies think they can get those 2 and someone to 
answer the phone all 
in one package for double minimum wage ... oh well ... If your designers use GUIs and 
think they know what they are doing ... well  I don't know. Maybe M$ has a 
solution that works for that 
environment. 


Peter


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




RE: [PHP] Seperating presentation from logic

2002-06-26 Thread David Freeman


 > >>Wouldn't you ultimately be better off moving most of this sort of
 > > thing
 > >>into style sheets and then have the designers play with the style
 > > sheets instead?

 > > What if your designer wants to change from a two column 
 > table to a four column table. Or change the menu from a vertical
column on 
 > the left to a horizontal row on the bottom that's run by images
instead of text. 

 > Actually, I think the idea behind what the previous poster 
 > was saying is that:
 > a) with stylesheets they don't need to touch the HTML once they've 
 > finished with it (and handed it over to you for PHP work)
 > b) you therefore won't need templates

Mostly my original comment above was in relation to someone's response
where they said they had defined a whole stack of variables for each
file (eg. $fontMain, $fontCopyright and so on) and my point was
specifically in relation to that.  Certainly, for layout and other
aspects a style sheet is not the whole solution but when it comes to
display elements such as fonts and colours I'd have to say that it _IS_
the solution.

CYA, Dave




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




Re: [PHP] Seperating presentation from logic

2002-06-26 Thread Erik Price


On Wednesday, June 26, 2002, at 09:05  AM, John Holmes wrote:

> I disagree. Maybe I'm just not getting it, or understanding the "FULL
> POWER" of xml/xslt. It just seems like it's adding in an additional
> layer that you don't need. It seems so dependent on browser versions,
> and parser versions, etc. Just make a plain HTML template and a small
> template parsing script to insert the variables you need. Pattemplate is
> pretty close to XSL, but I haven't seen any speed comparisons on it.

Yeah, but what if you want to output to a format other than HTML?  For 
instance you want to generate a PDF invoice, which is emailed to the 
user, but you also want to display that invoice to the user?  Should you 
have two separate files/sources of data?  You could have one XML file, 
and use XSL to make an HTML document which appears in the user's browser 
and a PDF which is emailed to them.

The point of XML is to look beyond the web browser as a point where the 
user needs data.  PDAs would benefit from non-HTML formatted stuff (too 
small a screen for most web pages), cell phones have their hardly-used 
WML, there are tons of different print formats like PDF or PostScript, 
plus alternative formats like troff (for man pages) and POD (for Perl 
manpages) and others.  XSLT lets you output from one source file to any 
desired format.

If you need versatility in the output of your data, XML can really help 
you.  Plus, it doesn't depend on browser version if that's what you're 
worried about -- it can be done server-side: use PHP to perform the 
transformation before it gets to the user if it's going to their 
browser.  That's why some XML-based sites let you choose whether to view 
the page in HTML or XML (so that if you want to use a spider or script 
to parse the data on the web page instead of looking at it in a browser, 
you can do that much more easily with the XML formatted output than the 
HTML formatted output).  Later on down the road, when (hopefully) all 
browsers incorporate an XSLT processor, the burden of performing the 
transformation can be handled by the client.

Not that client-side technology has been very successful at 
standardizing, in consideration of different JavaScript implementations, 
CSS implementations, and even Java Virtual Machines (witness Microsoft 
consistently refuse to ship a decent JVM with their OS, even though they 
are freely available from the Sun web site).

That's why server side stuff like PHP will probably always be invaluable.


Erik






Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


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




Re: [PHP] Seperating presentation from logic

2002-06-26 Thread Mark Gallagher

John Holmes wrote:
>>Wouldn't you ultimately be better off moving most of this sort of
> 
> thing
> 
>>into style sheets and then have the designers play with the style
> 
> sheets
> 
>>instead?
> 
> Sure, if all they are doing is playing with fonts, colors, sizes, etc...
> 
> What if your designer wants to change from a two column table to a four
> column table. Or change the menu from a vertical column on the left to a
> horizontal row on the bottom that's run by images instead of text. 

Theoretically this could still be done only with editing of the 
stylesheet.  Of course, it's not that simple - Mozilla comes closest to 
decent browser support for that sort of radical change, and even it's 
not there yet.

> Do you trust your designer to do all that and not mess up any of your
> PHP code that's thrown in with the HTML? That's why you use templates...

Actually, I think the idea behind what the previous poster was saying is 
that:
a) with stylesheets they don't need to touch the HTML once they've 
finished with it (and handed it over to you for PHP work)
b) you therefore won't need templates



-- 
Mark Gallagher
http://cyberfuddle.com/infinitebabble/






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




RE: [PHP] Seperating presentation from logic

2002-06-26 Thread John Holmes

> Wouldn't you ultimately be better off moving most of this sort of
thing
> into style sheets and then have the designers play with the style
sheets
> instead?

Sure, if all they are doing is playing with fonts, colors, sizes, etc...

What if your designer wants to change from a two column table to a four
column table. Or change the menu from a vertical column on the left to a
horizontal row on the bottom that's run by images instead of text. 

Do you trust your designer to do all that and not mess up any of your
PHP code that's thrown in with the HTML? That's why you use templates...

---John Holmes...


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




RE: [PHP] Seperating presentation from logic

2002-06-26 Thread John Holmes

> personnaly, I agree with you, and I would really like to see more PHP
> frameworks (or template systems) rely on XML/XSLT.
> you can have a look at :
> http://www.interakt.ro/products/Krysalis/

I disagree. Maybe I'm just not getting it, or understanding the "FULL
POWER" of xml/xslt. It just seems like it's adding in an additional
layer that you don't need. It seems so dependent on browser versions,
and parser versions, etc. Just make a plain HTML template and a small
template parsing script to insert the variables you need. Pattemplate is
pretty close to XSL, but I haven't seen any speed comparisons on it. 

---John Holmes... 


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




RE: [PHP] Seperating presentation from logic

2002-06-26 Thread David Freeman


 >  
 > $siteTitle
 > 
 > $colBg = "#FF";
 > $colText = "#FFCC99";
 > $colLink = "#EE";
 > $colComplimentary = "#CC6600";
 > 
 > 
 > $fontHeading = " size=\"3\">";

Wouldn't you ultimately be better off moving most of this sort of thing
into style sheets and then have the designers play with the style sheets
instead?

What I tend to do is define style classes for various functional areas
in my web sites and then my designer can figure out the design aspects
based on those constraints.  When you get down to it style sheets help
you to stay consistent in your layouts - after all, you do want all your
body text to be the same don't you?  So if you define a bodytext class
and then code that into your back-end it is always going to be that way.
If the designer then decides that they want Times New Roman instead of
Comic Sans as the body font they can change it in the style sheet and
everything else changes accordingly.

CYA, Dave




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




RE: [PHP] Seperating presentation from logic

2002-06-26 Thread phpsurf

personnaly, I agree with you, and I would really like to see more PHP
frameworks (or template systems) rely on XML/XSLT.
you can have a look at :
http://www.interakt.ro/products/Krysalis/

it's a sort of rewrite of cocoon in PHP ...
I had a look to the code, but never used it yet on a real project.
looks interesting ...

> -Original Message-
> From: Jerome Houston [mailto:[EMAIL PROTECTED]]
> Sent: mardi 25 juin 2002 20:51
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: RE: [PHP] Seperating presentation from logic
>
>
> Is there a particular reason everyone is skipping over the idea of using
> XML/XSLT?  What you're talking about is EXACTLY what XSLT was
> designed for.
> You can write scripts that access the DB, and output XML.  Then
> you just use
> XSL files written by your designers to translate your XML into
> HTML.  they
> get to choose EVERYTHING about what the page looks like.
>
> Granted, your designers need to learn a little XSL, but it sounds
> like, for
> what you're doing, they wouldn't need to learn much.  If you're going to
> teach them to use something proprietary like pattemplate (as mentioned
> below), why not spend that time teaching them to use XSL, which
> is easy to
> use and isn't proprietary, it's actually W3 specified.
>
> for info on how to get it working with php, go to:
> http://www.webmasterbase.com/article/602
>
> some people may disagree.
>
> -jerome
>
> >Basically, like someone else said, you teach your HTML
> >designers to use custom tags that your template engine will recognize
> >and place the correct values for.
> >
> >To make a loop, you'd tell your designers to do something like this
> >
> >
> >{filename}
> >
> >
> >It's not exactly like that, mind you, but you get the idea.
> >
> >You can't ever completely separate you designers and programmers. What
> >you do is provide an easy to understand way for your designers to
> >include the programming elements. What's easier, teaching them to put
> > or {name} in the document???
>
>
> _
> MSN Photos is the easiest way to share and print your photos:
> http://photos.msn.com/support/worldwide.aspx
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

 
__
ifrance.com, l'email gratuit le plus complet de l'Internet !
vos emails depuis un navigateur, en POP3, sur Minitel, sur le WAP...
http://www.ifrance.com/_reloc/email.emailif



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




RE: [PHP] Seperating presentation from logic

2002-06-25 Thread Jerome Houston

Is there a particular reason everyone is skipping over the idea of using 
XML/XSLT?  What you're talking about is EXACTLY what XSLT was designed for.  
You can write scripts that access the DB, and output XML.  Then you just use 
XSL files written by your designers to translate your XML into HTML.  they 
get to choose EVERYTHING about what the page looks like.

Granted, your designers need to learn a little XSL, but it sounds like, for 
what you're doing, they wouldn't need to learn much.  If you're going to 
teach them to use something proprietary like pattemplate (as mentioned 
below), why not spend that time teaching them to use XSL, which is easy to 
use and isn't proprietary, it's actually W3 specified.

for info on how to get it working with php, go to:
http://www.webmasterbase.com/article/602

some people may disagree.

-jerome

>Basically, like someone else said, you teach your HTML
>designers to use custom tags that your template engine will recognize
>and place the correct values for.
>
>To make a loop, you'd tell your designers to do something like this
>
>
>{filename}
>
>
>It's not exactly like that, mind you, but you get the idea.
>
>You can't ever completely separate you designers and programmers. What
>you do is provide an easy to understand way for your designers to
>include the programming elements. What's easier, teaching them to put
> or {name} in the document???


_
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx


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




RE: [PHP] Seperating presentation from logic

2002-06-25 Thread SP

There are a ton of template systems.  Look here for performance benchmarks:
http://www.phpinsider.com/benchmarks_phemplate

Unfortunately pattemplate isn't tested so I don't know how it rates.



-Original Message-
From: John Holmes [mailto:[EMAIL PROTECTED]]
Sent: June 25, 2002 12:02 PM
To: 'Jean-Christian Imbeault'; [EMAIL PROTECTED]
Subject: RE: [PHP] Seperating presentation from logic


You really want a template system. Check out Smarty or patTemplate.
Devshed.com has a nice two part tutorial on patTemplate and I like how
it looks a little better than Smarty right now. Might want to evaluate
both and see which is faster or easier.

I was going to give an example of patTemplate, but the devshed page
isn't coming up. Basically, like someone else said, you teach your HTML
designers to use custom tags that your template engine will recognize
and place the correct values for.

To make a loop, you'd tell your designers to do something like this



{filename}


It's not exactly like that, mind you, but you get the idea.

You can't ever completely separate you designers and programmers. What
you do is provide an easy to understand way for your designers to
include the programming elements. What's easier, teaching them to put
 or {name} in the document???

---John Holmes...


> -Original Message-
> From: Jean-Christian Imbeault [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, June 25, 2002 3:50 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] Seperating presentation from logic
>
> Thanks for the links. Hard to figure out what those things are just
from
> their web pages. They should work on making it easier to figure what
the
> projects are.
>
> I'll have a look but ...
>
> Maybe my message was too vague but what I meant is that my designers
> will come up with the site layout, colours, graphics etc ... I want
them
> to be able to do all their work without thinking about any
programming.
>
> If they want to make a page that lists in a table all the documents we
> have from 1999-2001, then they can can do this easily without worrying
> about me.
>
> And just as importantly I can code the scripts that will generate the
> table without worrying that maybe in the future the layout will
change.
>
> So I how can I do this? i.e. if the designers want to change the
> background colour on one page how can they do this without coming to
seem?
>
> Jc
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php



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




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




RE: [PHP] Seperating presentation from logic

2002-06-25 Thread John Holmes

You really want a template system. Check out Smarty or patTemplate.
Devshed.com has a nice two part tutorial on patTemplate and I like how
it looks a little better than Smarty right now. Might want to evaluate
both and see which is faster or easier. 

I was going to give an example of patTemplate, but the devshed page
isn't coming up. Basically, like someone else said, you teach your HTML
designers to use custom tags that your template engine will recognize
and place the correct values for.

To make a loop, you'd tell your designers to do something like this



{filename}


It's not exactly like that, mind you, but you get the idea. 

You can't ever completely separate you designers and programmers. What
you do is provide an easy to understand way for your designers to
include the programming elements. What's easier, teaching them to put
 or {name} in the document???

---John Holmes...


> -Original Message-
> From: Jean-Christian Imbeault [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, June 25, 2002 3:50 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] Seperating presentation from logic
> 
> Thanks for the links. Hard to figure out what those things are just
from
> their web pages. They should work on making it easier to figure what
the
> projects are.
> 
> I'll have a look but ...
> 
> Maybe my message was too vague but what I meant is that my designers
> will come up with the site layout, colours, graphics etc ... I want
them
> to be able to do all their work without thinking about any
programming.
> 
> If they want to make a page that lists in a table all the documents we
> have from 1999-2001, then they can can do this easily without worrying
> about me.
> 
> And just as importantly I can code the scripts that will generate the
> table without worrying that maybe in the future the layout will
change.
> 
> So I how can I do this? i.e. if the designers want to change the
> background colour on one page how can they do this without coming to
seem?
> 
> Jc
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php



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




RE: [PHP] Seperating presentation from logic

2002-06-25 Thread SP

I recommend http://smarty.php.net for seperating presentation from logic.
It's one of the best template systems currently.  It worked out of the box
for me but it took me like the long weekend to figure out some of the config
folders.  It does your standard variable substitution {$bgcolor} but what I
like about it is that it lets you code your own custom tags for your
designers like {display_calender} so it hides all the php code for
displaying a calender or something.  Your designer just types in
{display_calender} in the html files and it comes out a calender everytime.



-Original Message-
From: Jean-Christian Imbeault [mailto:[EMAIL PROTECTED]]
Sent: June 25, 2002 1:00 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Seperating presentation from logic


I'm just about to start a large PHP project in which I get to work with
professional designers/layout people. I want to separate all the
programming logic from the presentation but I am not sure how to do this.

Can anyone point me to resources (web tutorials/articles or books) that
would help me figure out how best to separate my programming work from
designer's work and how best to integrate them?

Sorry for asking such a generic question but I don't know how to best
phrase it. I did look on the web but the best I could find were some
mentions of templates. While templates seems ok they don't address all
the issues of separation presentation from code (if I understand them
correctly).

Thanks!

Jc


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




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




Re: [PHP] Seperating presentation from logic

2002-06-25 Thread Justin French

on 25/06/02 6:40 PM, Jean-Christian Imbeault ([EMAIL PROTECTED])
wrote:

> Some of the "issues" are things like how to make it painless for both
> the designers and me if one day, out of the blue, a designers decides
> that the background colour should be changed, or the graphics changed.
> Or even worse the two column layout should be a three column layout.

well, some things are easy (see my other posts about colours) and some
things are hard (2 col layout changing to 3), although not impossible.

decide on a allowed set of changes the design team can make/have access to,
and stick to it... anything else will require more code, and more time.


> But to start off with simple things like:
> 
> Designer:
> - on this page a dynamic table will be generated according to the search
> criteria entered by the user
> - lines will have alternating colours
>
> I can code this easily, but what if the designer then decides that he
> wants each *third* line to alternate colour, or he wants to use three
> colours instead of two (a pattern 1,2,3,1,2,3 instead of 1,2,1,2).
>
> How can I make it so that he can do these changes without coming to see
> me to change the code that outputs the data used in the table?

Well, then you work on a set of code that allows for configuration of the
table to alternate in 2 or 3 colours (1st rule established -- not < 2, not >
3), and then allow them to set the 2 or 3 values via a colour configuration
file (see other posts) which is included at the top of the page.

Proving them ACCESS to these configuration values can be as simple as
allowing them to write/change the config.php file, or it might involve a
content management system with a GUI web based control panel.

Generally the config aren't hard, it's executing them in a function wrapper
/ code block.


Establish rules, design config variables to accomodate the options, allow
access to these config variables (a flat file, mysql values, whatever), then
accomodate these config options in code.


Yes, providing code that allows for 2 OR 3 alternating color rows in a
table will be a lot more than for just 2, so you need to establish if this
is a priority.


Justin French


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




Re: [PHP] Seperating presentation from logic

2002-06-25 Thread Justin French

on 25/06/02 5:50 PM, Jean-Christian Imbeault ([EMAIL PROTECTED])
wrote:

> Maybe my message was too vague but what I meant is that my designers
> will come up with the site layout, colours, graphics etc ... I want them
> to be able to do all their work without thinking about any programming.

Why can't you specify them to make comments to , or
better still specify which file to include with


??

> If they want to make a page that lists in a table all the documents we
> have from 1999-2001, then they can can do this easily without worrying
> about me.

Yes, but things like sessions, form validation, etc will require more
indepth scripts, possibly with thing in the headers, and much more
conditional style pages with lots of if()'s.


> And just as importantly I can code the scripts that will generate the
> table without worrying that maybe in the future the layout will change.

ask them to write an include statement at the point where your table needs
to appear.

> So I how can I do this? i.e. if the designers want to change the
> background colour on one page how can they do this without coming to seem?

See my other post on this topic... have a set of predefined variables which
both you and they have access to, and include this set of vars on every
page... these can be for the colour pallet, font tags, and all sorts of
other stuff which can be changed centrally (once) by modifying the config
file, affecting all templated pages.

You need to sit down and figure out what you want to give them access to,
and try to define these as variables.

";

$fontBody = "";

$fontCopyright = "";

?>

The calling in HTML code might be:





My Heading
The main body text
Copyright me 2002




They can change the config file as many times as they want!


Justin French


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




Re: [PHP] Seperating presentation from logic

2002-06-25 Thread Jean-Christian Imbeault

Thanks! I'll visit and read all the links you gave.

Some of the "issues" are things like how to make it painless for both 
the designers and me if one day, out of the blue, a designers decides 
that the background colour should be changed, or the graphics changed. 
Or even worse the two column layout should be a three column layout.

But to start off with simple things like:

Designer:
- on this page a dynamic table will be generated according to the search 
criteria entered by the user
- lines will have alternating colours

I can code this easily, but what if the designer then decides that he 
wants each *third* line to alternate colour, or he wants to use three 
colours instead of two (a pattern 1,2,3,1,2,3 instead of 1,2,1,2).

How can I make it so that he can do these changes without coming to see 
me to change the code that outputs the data used in the table?

Simple things like that ;)

Jc
Justin French wrote:

> I think the issues are VERY project specific.  Luckily for me I'm the
> DESIGNER and PROGRAMMER on many of my projects, but often I'm just one of
> the two.
> 
> When I'm just designing, I obviously need to develop page templates, but
> more and more of my time is spent developing style guides (often also called
> VM's (visual manifestos), among others).
> 
> Basically, if a Style Guide is done right, programmers can make a whole heap
> of design-related decisions as they go.  This can be in the form of colour
> guides, type styles, heading treatment, image treatment, spacing, layout
> styles, form presentation, etc etc.
> 
> If the programmer reads and understands the rules, then a LOT of back and
> forth can be saved.
> 
> 
> Commonly a site may have:
> 
> --
> | common header  |
> --
> ||
> | dynamic middle section |
> ||
> ||
> --
> | common footer  |
> --
> 
> 
> What you want to do is have the designer "design" the header and footer, and
> provide style guides and samples of what might happen in the middle.
> 
> 
> From there, it depends on how far you want to separate the code and content.
> 
> Simple things like:
> 
> - defining $col1 $col2 $col3 colours which can be changed for a different
> pallet at any time
> - defining font tags like $fontBig $fontHeading $fontCopyright which can be
> changed site-wide at any time
> 
> Slightly more complex things like a webbox/fusebox architecture
> (http://www.phpbuilder.com/columns/bill19990831.php3), or even just
> separating the TEXT of the pages out into separate plain text files or into
> a database will be a major help.
> 
> Also check out http://bombusbee.com & http://www.fusebox.org in relation to
> fuseboxes.
> 
> Then talk about CSS -- the whole aim of CSS is to separate content from
> design/mark-up.  There's a pretty good article on SitePoint
> (http://www.WebmasterBase.com/article/379) which brushes the surface.
> 
> 
> There's about another 5 or six articles on this page worth reading:
> http://www.phpbuilder.com/columns/
> 
> And I'd recommend spending a LOT of time at http://SitePoint.com
> (http://www.WebmasterBase.com).
> 
> 
> 
> 
> I think you need to define the "issues" you mention, and them we can all
> help with some solutions :)
> 
> 
> 
> on 25/06/02 3:00 PM, Jean-Christian Imbeault ([EMAIL PROTECTED])
> wrote:
> 
> 
>>I'm just about to start a large PHP project in which I get to work with
>>professional designers/layout people. I want to separate all the
>>programming logic from the presentation but I am not sure how to do this.
>>
>>Can anyone point me to resources (web tutorials/articles or books) that
>>would help me figure out how best to separate my programming work from
>>designer's work and how best to integrate them?
>>
>>Sorry for asking such a generic question but I don't know how to best
>>phrase it. I did look on the web but the best I could find were some
>>mentions of templates. While templates seems ok they don't address all
>>the issues of separation presentation from code (if I understand them
>>correctly).
>>
>>Thanks!
>>
>>Jc
>>
>>
> 


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




Re: [PHP] Seperating presentation from logic

2002-06-25 Thread Justin French

I think the issues are VERY project specific.  Luckily for me I'm the
DESIGNER and PROGRAMMER on many of my projects, but often I'm just one of
the two.

When I'm just designing, I obviously need to develop page templates, but
more and more of my time is spent developing style guides (often also called
VM's (visual manifestos), among others).

Basically, if a Style Guide is done right, programmers can make a whole heap
of design-related decisions as they go.  This can be in the form of colour
guides, type styles, heading treatment, image treatment, spacing, layout
styles, form presentation, etc etc.

If the programmer reads and understands the rules, then a LOT of back and
forth can be saved.


Commonly a site may have:

--
| common header  |
--
||
| dynamic middle section |
||
||
--
| common footer  |
--


What you want to do is have the designer "design" the header and footer, and
provide style guides and samples of what might happen in the middle.


>From there, it depends on how far you want to separate the code and content.

Simple things like:

- defining $col1 $col2 $col3 colours which can be changed for a different
pallet at any time
- defining font tags like $fontBig $fontHeading $fontCopyright which can be
changed site-wide at any time

Slightly more complex things like a webbox/fusebox architecture
(http://www.phpbuilder.com/columns/bill19990831.php3), or even just
separating the TEXT of the pages out into separate plain text files or into
a database will be a major help.

Also check out http://bombusbee.com & http://www.fusebox.org in relation to
fuseboxes.

Then talk about CSS -- the whole aim of CSS is to separate content from
design/mark-up.  There's a pretty good article on SitePoint
(http://www.WebmasterBase.com/article/379) which brushes the surface.


There's about another 5 or six articles on this page worth reading:
http://www.phpbuilder.com/columns/

And I'd recommend spending a LOT of time at http://SitePoint.com
(http://www.WebmasterBase.com).




I think you need to define the "issues" you mention, and them we can all
help with some solutions :)



on 25/06/02 3:00 PM, Jean-Christian Imbeault ([EMAIL PROTECTED])
wrote:

> I'm just about to start a large PHP project in which I get to work with
> professional designers/layout people. I want to separate all the
> programming logic from the presentation but I am not sure how to do this.
> 
> Can anyone point me to resources (web tutorials/articles or books) that
> would help me figure out how best to separate my programming work from
> designer's work and how best to integrate them?
> 
> Sorry for asking such a generic question but I don't know how to best
> phrase it. I did look on the web but the best I could find were some
> mentions of templates. While templates seems ok they don't address all
> the issues of separation presentation from code (if I understand them
> correctly).
> 
> Thanks!
> 
> Jc
> 


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




Re: [PHP] Seperating presentation from logic

2002-06-25 Thread René Moonen

Well... I still think that these tools can help.

For example PHPWebSite (which I use for our Intranet) has a set of 
'themes'. A theme consists of a style sheet (.css), some image files 
(logo's, backgrounds etc.) and a small set of PHP scripts that define 
things like standard header, footers.

If you would like to change the look and feel, you 'just' have to change 
(or add) the theme plugin. Examples are also on the phpwebsite homepage.
You can even allow visitors to select a different theme when they visit 
the website.

Now it depends on how much your designers know about style sheets etc. 
Would you trust them changing a style sheet and some images? If not than 
your project could very well be that you have to write a 'theme editor'. 
A kind of user interface that designers can use to build the theme files.

But anyway 'content mangers'  (phpwebsite / phpnuke) do seperate the 
application from the contents, but also application from design. 
Allthough the later not as far as I suppose you would need for your project.

good luck

René


p.s. these tools require a database on the webserver as well, so if you 
download phpwebsite or phpnuke,  be prepared to also have a database 
installed on your webserver.


Jean-Christian Imbeault wrote:

> Thanks for the links. Hard to figure out what those things are just 
> from their web pages. They should work on making it easier to figure 
> what the projects are.
>
> I'll have a look but ...
>
> Maybe my message was too vague but what I meant is that my designers 
> will come up with the site layout, colours, graphics etc ... I want 
> them to be able to do all their work without thinking about any 
> programming.
>
> If they want to make a page that lists in a table all the documents we 
> have from 1999-2001, then they can can do this easily without worrying 
> about me.
>
> And just as importantly I can code the scripts that will generate the 
> table without worrying that maybe in the future the layout will change.
>
> So I how can I do this? i.e. if the designers want to change the 
> background colour on one page how can they do this without coming to 
> seem?
>
> Jc
>
>


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




Re: [PHP] Seperating presentation from logic

2002-06-25 Thread Jean-Christian Imbeault

Thanks for the links. Hard to figure out what those things are just from 
their web pages. They should work on making it easier to figure what the 
projects are.

I'll have a look but ...

Maybe my message was too vague but what I meant is that my designers 
will come up with the site layout, colours, graphics etc ... I want them 
to be able to do all their work without thinking about any programming.

If they want to make a page that lists in a table all the documents we 
have from 1999-2001, then they can can do this easily without worrying 
about me.

And just as importantly I can code the scripts that will generate the 
table without worrying that maybe in the future the layout will change.

So I how can I do this? i.e. if the designers want to change the 
background colour on one page how can they do this without coming to seem?

Jc


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




Re: [PHP] Seperating presentation from logic

2002-06-24 Thread René Moonen

You might want to start by looking (download, instal, try) at available 
content managers like
PHPWebSite   http://phpwebsite.appstate.edu/ 
PHPNukehttp://phpnuke.org/

They do exactly that; seperate content from programming logic. As an 
admin you can assign certain users as beining authors. Authors can 
upload contents to the web-server without every having to know anything 
about PHP, webservers or databases. As an admin you can change the look 
and feel of the webpage without having to know much about PHP. It's 
designing a new 'skin' rather than desiging a complete new PHP project.
It might very well be that these content managers do not fit your needs, 
but if you start from scratch they are certainly worth looking into 
before you take off on a large PHP project.

good luck

René

Jean-Christian Imbeault wrote:

> I'm just about to start a large PHP project in which I get to work 
> with professional designers/layout people. I want to separate all the 
> programming logic from the presentation but I am not sure how to do this.
>
> Can anyone point me to resources (web tutorials/articles or books) 
> that would help me figure out how best to separate my programming work 
> from designer's work and how best to integrate them?
>
> Sorry for asking such a generic question but I don't know how to best 
> phrase it. I did look on the web but the best I could find were some 
> mentions of templates. While templates seems ok they don't address all 
> the issues of separation presentation from code (if I understand them 
> correctly).
>
> Thanks!
>
> Jc
>
>


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