Hello,
I am using Simpe_html_dom to parse an html table; however, I am having problem getting the content of a <td> that have secondary <table> nested in them. I would like to grab the content of all parent <tr>, each of which contains 3 <td> cells. The middle cell is the one containing a a nested table.
Here is a sample layout of the table:
<table id="tblClubs" border="1" cellpadding="2" width="858">
<tr> <!--first tr--BEGINS->
<td class="clubRow">
<a href="http://www.BITTA.US">Big Island Table Tennis Association</a><br><font size="-1">(11/30/2014)</font>
</td>
<td align="center" valign="middle" width="500">
<table width="98%" border="1" cellpadding="2">
<tr>
<td width="60%" class="clubRowEven">Boys and Girls Club<br>100 Kamakahonu St.<br>Hilo, HI 96720</td>
<td width="40%" class="clubRowEven">Tuesday - 2:30 to 5:30PM, Saturday - 4:00 to 7:00PM, Sunday - 1:00 to 4:00PM</td>
</tr>
<tr>
<td width="60%" class="clubRowOdd">Waimea Community Center<br>Waimea, HI <br><br><u>Directions</u>:<br>Contact - John Romoa 808-xxx-8443</td>
<td width="40%" class="clubRowOdd">Wednesday - 4:30 to 8:00PM</td>
</tr>
<tr>
<td width="60%" class="clubRowEven">Yano Hall (Kealakekua, So. Kona)<br>South Kona, HI </td>
<td width="40%" class="clubRowEven">Â </td>
</tr>
</table>
</td>
<td class="clubRow">
<a href="mailto:xxx.xxxx@hpmhawaii.com">Russel xxx</a><br>808-959-4688
</td>
</tr> <!--FIRST tr--ENDS->
<tr> <!--second tr--BEGINS->
<td bgcolor="whitesmoke" class="clubRow">
<a href="http://sites.google.com/site/hitabletennis/">Hawaii Table Tennis Club</a><br><font size="-1">(2/28/2014)</font>
</td>
<td align="center" valign="middle" width="500" bgcolor="whitesmoke">
<table width="98%" border="1" cellpadding="2">
<tr>
<td width="60%" class="clubRowEven">Palama Settlement - Gym<br>810 North Vineyard Blvd.<br>Honolulu, HI 96817</td>
<td width="40%" class="clubRowEven">Sunday - 5:30 - 9:00PM</td>
</tr>
</table>
</td>
<td bgcolor="whitesmoke" class="clubRow">
<a href="mailto:hawaiitabletennisclub@yahoo.com">Rick xxx</a><br>808-222-0420
</td>
</tr> <!--second tr--ENDS->
</table>
In the sample table above, I would like to grab the content of each <td> for both the parent <tr> in the table and build an array. The content of Each parent <td> of each parent <tr> would be a key =>value. All content inside the nested table of the middle parent <td> needs to be a sub array of that <td>.
Essentially, the array of the table above should look like this:
Array
(
[0] => Array
(
[cname] => 'Big Island Table Tennis Association
(2/28/2014)'
[locale] =>
array (
[add_1] => 'Boys and Girls Club
100 Kamakahonu St.
Hilo, HI 96720'
[days_time] => 'Tuesday - 2:30 to 5:30PM, Saturday - 4:00 to 7:00PM, Sunday - 1:00 to 4:00PM'
[add_2] => 'Waimea Community Center
Waimea, HI
Directions:<br>Contact - John Romoa 808-345-8443'
[days_time_2] => 'Wednesday - 4:30 to 8:00PM'
[add_3] => 'Yano Hall (Kealakekua, So. Kona)<br>South Kona, HI'
[days_time_3] => 'Â'
)
[contact] => 'Russel xxx 808-959-4688'
)
[1] => Array
(
[cName] => 'Hawaii Table Tennis Club
(2/28/2014)'
[locale] => array (
[address] => 'Palama Settlement - Gym<br>810 North Vineyard Blvd.<br>Honolulu, HI 96817'
[days_time] => 'Sunday - 5:30 - 9:00PM'
)
[contact] => 'Rick xxxx
808-222-0420'
)
)
I really hope I am making some sense with this request. Any thoughts is really appreciated!
Mossa