Re: Using PHP/HTML effectivly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux