500以上のアイテムを含む長いxmlデータファイルがあります。次の形式で提供されます。
<?xml version="1.0" encoding="ISO-8859-1"?>
<CATALOG>
<ITEM>
<TITLE>ITEM name</TITLE>
<TYPE>TYPE </TYPE>
<DESCIPTION>DESCIPTIONiliate Page CPM</DESCIPTION>
<PRICE>PRICE</PRICE>
<ITEM>http://mysite.com/item-link</ITEM>
</ITEM>
</CATALOG>
phpページで次のコードを使用してxmlファイルからデータをインポートします。
<?php
$ITEMSS = new SimpleXMLElement('ITEMS.xml', null, true);
echo <<<EOF
<table width="100%" align="center" border="1" bordercolor="#0099ff" cellpadding="1" cellspacing="0">
<tr>
<th bgcolor="#66ccff"><span class="style4">ITEM Name</span></th>
<th bgcolor="#66ccff"><span class="style4">item TYPE </span></th>
<th bgcolor="#66ccff"><span class="style4">item DESCIPTION </span></th>
<th bgcolor="#66ccff"><span class="style4">item PRICE</span></th>
<th bgcolor="#66ccff"><span class="style4">link to item</span></th>
</tr>
EOF;
foreach($ITEMSS as $ITEMS) // loop through our DATAS
{
echo <<<EOF
<tr height="30" align=middle>
<td><a href="{$ITEMS->ITEM}" target="_blank"><span class="STYLE7">{$ITEMS->TITLE}</span></a></td>
<td><span class="STYLE8">{$ITEMS->TYPE}</span></td>
<td><span class="STYLE8">{$ITEMS->DESCIPTION}</span></td>
<td><span class="STYLE8">{$ITEMS->PRICE}</span></td>
<td><a href="{$ITEMS->ITEM}" target="_blank"><B><span class="STYLE7">cHECK IT OUT</span></B></a></td>
</tr>
EOF;
}
echo '</table>';
?>
ループに「if」ステートメントを追加して、「TYPE」に特定の値がある場合に一部のデータのみを選択する必要があります。そうでない場合は、そのデータが表示され、スキップされます。
また、ページングシステムを追加する必要があります。これは、500以上のアイテムがリストされるため、テーブルに25と言う混合アイテム数を表示する必要があります。
皆さん、助けてくれてありがとう!