Jump to content

give last div a dissferent class?


toolman

Recommended Posts

Here is a very rudimentary example

//Create function to output one DIV of content for a record
function displayContent($value, $class)
{
    echo "<div class='{$class}'>{$value}</div>\n";
}

//Loop through records to be displayed
foreach($arrayOfData as $recordID => $value)
{
    if(isset($prevValue))
    {
         //Create output for previous value/record
         //Using selected class/style
         displayContent($prevValue, 'alignRight');
    }
    $prevValue = $value;
}

//Create output for very last record using a different class
displayContent($lastValue, 'alignLeft');

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.