插件28:创建列表

<?php // Plug-in 28: Create List

// This is an executable example with additional code supplied
// To obtain just the plug-ins please click on the Download link

$fruits   = array("Apple", "Pear", "Banana", "Plum", "Orange");
$bullets1 = array("1", "A", "a", "I", "i");
$bullets2 = array("disc", "square", "circle");

echo "<table border='0' width='100%'><tr>";

for ($j = 0 ; $j < 5 ; ++$j)
   echo"<td>" . PIPHP_CreateList($fruits, 1, "ol",
      $bullets1[$j]) . "</td>\n";

echo "</tr><tr>";

for ($j = 0 ; $j < 3 ; ++$j)
   echo"<td>" . PIPHP_CreateList($fruits, 1, "ul",
      $bullets2[$j]) . "</td>\n";

echo "<td colspan='2'></td></tr></table>";

function PIPHP_CreateList($items, $start, $type, $bullet)
{
   // Plug-in 28: Create List
   //
   // This plug-in accepts an array containing a list of
   // items to be displayed in an HTML list, along with some
   // arguments specifying the format, and returns the HTML
   // for the completed list. The arguments requiredare:
   //
   //    $items:  An array containing a list of items
   //    $start:  The start number if displaying ordered list
   //    $type:   The type of list. Either "ol" for ordered,
   //             or "ul" for unordered.
   //    $bullet: The type of bullet. If $type is "ol" the
   //             bullet types can be "1" for numeric, "A"
   //             for upper case alphabetic, "a" for lower
   //             case alphabetic, "I" for upper case Roman,
   //             or "i for lower case Roman numerals. If
   //             $type is "ul" then $bullet can be one of
   //             "disc", "square" or "circle".

   $list = "<$type start='$start' type='$bullet'>";
   foreach ($items as $item) $list .= "<li>$item</li>";
   return $list . "</$type>";
}

?>

插件说明:

本插件需要输入一个数组和列表的格式控制参数。这个数组包含了一个列表的全部列表项,他需要以下参数:

$item 数组,它包含一个列表的全部列表项

$start 有序列表的起始编号

$type 列表的类型,ul表示无序列表,ol表示有序了表。

$bullet 项目符号或列表编号的类型。对于无序列表,有正方形、圆形和圆盘形。

             对于有序列表,又l,A,a,I或i


你可能感兴趣的:(html,apple,list,download,border,Types)