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

Reply via email to