Re: Quotes vs. Single Quote

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

 



At 11:00 PM -0400 8/5/10, Paul M Foster wrote:
On Thu, Aug 05, 2010 at 10:10:26PM -0400, Rick Dwyer wrote:

 > echo "<table border='1'><tr>....

 And elsewhere on the page it follows:

 > echo '<table border="1"><tr>....

Not acceptable and sloppy. Be consistent in your coding style. In
general, HTML attributes should be surrounded by double quotes. I don't
know about javascript. Moreover, it's generally better to simply output
HTML rather than to echo it, like:

<table border="1"><tr>
<td>
<?php echo $some_value; ?>
</td>

Rick:

I agree with Paul.

I would only add that you should use what languages best serve your needs. While it may not be obvious, the statement:

<table border="1">

is flawed (IMO).

The "best" way to handle this is to define a class (or id) for the table in a css file and then set the border (i.e., styling) to whatever you want. For example, your HTML would look like:

<table class="my_table">

And your CSS would contain:

.my_table
   {
   border: 1px solid black;
   }

That way at some future date, you may want to change the border color, size, whatever and it's a trivial thing to do so without having to search through all your code to find ill-placed styling attributes.

As I always say, neither CSS, PHP, or any web language exist in a vacuum. It always best to use whatever language that makes your life (and others) simpler.

Cheers,

tedd

PS: Considering that this is Friday. I have a grammar question for the group. I said above:

"neither CSS, PHP, or any web language exist in a vacuum."

Is the word "neither" appropriate in this sentence?

Normally, two items can be compared by "neither" or "nor", but what about more than two items? Is it appropriate to use "neither" or "nor" for more than two items?

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
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