Re: Using PHP/HTML effectivly

From: Date: Thu, 15 Jun 2006 07:56:49 +0000
Subject: Re: Using PHP/HTML effectivly
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-238052@lists.php.net to get a copy of this message
On Wed, June 14, 2006 3:28 pm, BBC wrote: > I used many functions as template to change the html syntax. > this is one of the function as a sample: > <?php > function > tabletag($border="0",$width="100%",$height="100%",$cellpadding = > "0",$cellspacing="0",$style="") > { > print ("<table width=\"$width\" height =\"$height\" > border=\"$border\" > cellspacing=\"$cellspacing\" cellpadding=\"$cellpadding\" > style=\"$style\">"); > } > ?> Here are the 'cons' to this solution: 1. The developer has to remember the attributes in the order you chose. There is no friggin' way I'm going to remember that you put cellpadding before cellspacing on a day-to-day basis. Sorry. 2. If they want the default border, whatever that is, they have to know what it is, and provide it, to get the non-default width. Passing in NULL does not count, as it will not work in PHP5+ 3. You've basically swapped a simple table tag: <table border="0" width="100%" ... > with an almost equally long and complicated function call: tabletag(0, '100%', ...); So, really, where's the benefit?... You can just call the function, or you can just type the table tag. I see no "win' here, personally. Obviously others do see an added value, of course. > so I don't need to type "<table ....>", just call those functions. > and I don't think it works slowly (cause we just set one function for > many > tables) If you have enough TABLE tags for the performance to be an issue, then the browser willl choke... However, assuming you have a function for TR and/or TD, then the number of rows in a large TABLE could be a serious performance issue. This is all assuming proper use of TABLE for tabular data and not layout, thank you very much CSS weenies :-) -- Like Music? http://l-i-e.com/artists.htm

« previous php.general (#238052) next »