You are here: Re: Design methodology question « PHP Programming Language « IT news, forums, messages
Re: Design methodology question

Posted by David Haynes on 06/21/06 00:18

Chung Leong wrote:
> David Haynes wrote:
>> I was thinking about this at a finer-grained level than you seem to be
>> in that I was thinking that msch-prv was thinking of automating the
>> common HTML elements rather than doing something more complex.
>
> Well, it isn't really automation, since you still need to write the
> function call. Basically you're trying to communicate to the computer
> that you want an input element at that location. Using HTML as the
> language for this purpose guarantees full flexibility. You don't really
> gain much using PHP.

I was just thinking about the millions of times I have done something like:

if( ! empty($foos) ) {
printf("<select name=\"%s\">\n", $select_name);
foreach( $foo as $foo ) {
$selected = ($foo['bah'] == 'xxx' ) ? 'selected' : '';
printf("<option value=\"%s\" %s>%s</option>\n", $foo['value'],
$selected, $foo['label']);
}
printf("</selected>\n");
}

and was hoping that it could all be made simpler as something like:
$attributes = array('name' => 'foo');
htmlSelect($attributes, $foo);

in the hopes that the meaning for the page became clearer.

Maybe I'll play with this when I get a little more free time.

-david-

BTW: Why doesn't the foreach() handle the !empty() case? It would make
more sense IMHO.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация