[ create a new paste ] login | about

Link: http://codepad.org/bqo86ndY    [ raw code | output | fork ]

teena7084 - PHP, pasted on Sep 26:
<?php
function category_list( $category_parent_id = 0 )
{
      // populate a list items array
    $list_items = array();
    $list_items[] = '<td class="dataTableContent"><ul>';

    for($i=1; $i<=2;$i++)
    {
        // open the list item
        $list_items[] = '<li>';

        // construct the category link

        $list_items[] = 'list ' .$i;
       

        // close the list item
        $list_items[] = '</li>';
    }
    $list_items[] = '</ul></td>';

    // convert to a string
    return implode( '', $list_items );

}  


?>
<table border="1" width="100%" cellspacing="0" cellpadding="2">
    <tr class="dataTableHeadingRow">
        <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS; ?></td>
        <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TOTAL_WEIGHT; ?>&nbsp;</td>
    </tr>
    <tr class="dataTableRow">    
     <?php echo category_list(); ?>
       
</table>


Output:
1
2
3
4
5
6
7
8
<table border="1" width="100%" cellspacing="0" cellpadding="2">
    <tr class="dataTableHeadingRow">
        <td class="dataTableHeadingContent">TABLE_HEADING_PRODUCTS</td>
        <td class="dataTableHeadingContent" align="right">TABLE_HEADING_TOTAL_WEIGHT&nbsp;</td>
    </tr>
    <tr class="dataTableRow">    
     <td class="dataTableContent"><ul><li>list 1</li><li>list 2</li></ul></td>       
</table>


Create a new paste based on this one


Comments: