Вставленный php ломает конструкцию html

12
B
На сайте с 06.05.2012
Offline
14
#11
DiAksID:
есссесссно, что "нифига", если в источники 3 таблицы под паттерн попадают. нужна сверхжадная квантификация в патерне и вывод массива из таблиц. как вариант...

Ясно, короче геморроич получается.

---------- Добавлено 07.05.2012 в 19:05 ----------

developer_php:
Скопируйте сюда полностью код со страницы http://www.yr.no/place/Russia/Moscow/Moscow/, который вы хотите вытянуть.

Короче,

<table summary="" class="yr-table yr-table-overview2 yr-popup-area">

<caption>

<strong>Today, </strong>Monday 07/05/2012</caption>

<colgroup width="60"></colgroup>

<colgroup width="50"></colgroup>

<colgroup width="50"></colgroup>

<colgroup width="80"></colgroup>

<colgroup></colgroup>

<thead>

<tr>

<th scope="col">Time</th>

<th scope="col">Forecast</th>

<th scope="col">

<abbr title="Temperature">Temp.</abbr>

</th>

<th scope="col">Precipitation</th>

<th scope="col">Wind</th>

</tr>

</thead>

<tbody>

<tr>

<td> 22:00&ndash;01:00</td>

<td title="Partly cloudy. For the period: 22:00&ndash;01:00">

<img src="http://symbol.yr.no/grafikk/sym/b38/03d.png" alt="Partly cloudy. For the period: 22:00&ndash;01:00">

</td>

<td title="Temperature: 16°. Feels like 16°. For the period: 22:00" class="temperature plus">16°</td>

<td title="Precipitation: 0 mm. For the period: 22:00&ndash;01:00. ">0 mm</td>

<td title="Light breeze, 2 m/s from south-southwest. For the period: 22:00" class="txt-left">

<img alt="Light breeze, 2 m/s from south-southwest" class="wind" src="http://fil.nrk.no/yr/grafikk/vindpiler/32/vindpil.0025.210.png">Light breeze, 2 m/s from south-southwest</td>

</tr>

</tbody>

</table>

и еще:

есть таблица на http://www.yr.no/place/Russia/Moscow/Moscow/long.html - которая первая yr-table yr-table-longterm yr-popup-area, нуна сделать вывод этой таблицы не на 9 колонок, а на 7. Много возни будет? Мне кажется, что проще будет сделать для блока overflow: hidden и все тут. Как думаете?

DiAksID
На сайте с 02.08.2008
Offline
236
#12
Brazilik:
Ясно, короче геморроич получается.

всего лишь поставить ? перед </table> и понять что вывалиться массив выборок под все подходящие таблицы ;)

show must go on !!!...
DP
На сайте с 24.04.2012
Offline
16
#13

У меня эту таблицу выводит


preg_match("/<table class=\"yr-table yr-table-overview2 yr-popup-area\" summary=\"\">(.*)<\/table>/Uis", $text, $out);
echo $out[0];

Я обратил внимание, что аттрибуты нам он выдает в разном порядке. Не знаю почему.

Убрать 2 колонки удобно jquery. Я знаю такой способ:


<script type="text/javascript">
$(document).ready(function(){
$('table.yr-table-longterm').find("tr").each(function(){
$(this).find("td:eq(8), th:eq(8)").remove();
$(this).find("td:eq(7), th:eq(7)").remove();
});
});
</script>
B
На сайте с 06.05.2012
Offline
14
#14
developer_php:
У меня эту таблицу выводит

preg_match("/<table class=\"yr-table yr-table-overview2 yr-popup-area\" summary=\"\">(.*)<\/table>/Uis", $text, $out);
echo $out[0];

Я обратил внимание, что аттрибуты нам он выдает в разном порядке. Не знаю почему.

Убрать 2 колонки удобно jquery. Я знаю такой способ:

<script type="text/javascript">
$(document).ready(function(){
$('table.yr-table-longterm').find("tr").each(function(){
$(this).find("td:eq(8), th:eq(8)").remove();
$(this).find("td:eq(7), th:eq(7)").remove();
});
});
</script>

Спасибо огромное! Реально помогли;)

12

Авторизуйтесь или зарегистрируйтесь, чтобы оставить комментарий