Jump to content
Sign in to follow this  
Texan78

Dynamic populating rows

Recommended Posts

Hello, 

 

I am looking for some assistance with something I done before but forgot and I can't find my code snippets from when I used this method in the past. If you reference the screenshot below you will see boxes going across. What I am trying to do is put each one on its own row but can't remember how it is done. I have tried putting a <tr> in the loop but that doesn't work which I have commented out below where I had it for example purposes. Could anyone offer some help with this? BTW I am using this with bootstrap and calling it into the HTML template with jQuery so it refreshes on its own with updated information.

 

-Thanks 

// If no storms were in the source, set no storm message
if($error) {
     $AlertData .= "<div style='{$divNoStorms}' class='alert alert-info' role='alert' data-toggle='tooltip' data-placement='top' title='There are currently no active severe weather alerts.'>\n";
     $AlertData .= "{$noStormMessage}\n";
     $AlertData .= "</div>\n";                                                                                
} elseif ($event == 'Tornado Warning' || $event == 'Severe Thunderstorm Warning' || $event == 'Flash Flood Warning') {
    //$AlertData .= "<tr>\n";
    $AlertData .= "<div class='col-md-3'>\n";
    $AlertData .= "<div id='{$alertID}' class='individualAlert'>\n";
    $AlertData .= "<div class='text_alert'>\n";
    $AlertData .= "<span class='title {$alertClass}'><i class='fa fa-exclamation-triangle severe-icon__tornado'></i>{$event}</span>\n";
    $AlertData .= "<span class='state'>{$stateShort}</span>\n";
    $AlertData .= "<span class='counties'>{$area}</span>\n";
    $AlertData .= "<span class='expires'>Expires: {$expiresDate}</span>\n";
    $AlertData .= "</div>\n";
    $AlertData .= "<div class='alert__view'>\n";
    $AlertData .= "<span class='fa fa-eye'></span>\n";
    $AlertData .= "</div>\n";
    $AlertData .= "</div>\n";
}
    $AlertData .= "</div>\n";
    //$AlertData .= "</tr>\n";

       endforeach;
endif;

echo $AlertData;

severe_example.png

Share this post


Link to post
Share on other sites

You're using the part of Bootstrap's styling that sizes boxes. Don't do that.

Share this post


Link to post
Share on other sites

I don't know if I'm being blind here but where is the start of the for each loop? You have endforeach but I can't see where the loop starts

Share this post


Link to post
Share on other sites

I don't know if I'm being blind here but where is the start of the for each loop? You have endforeach but I can't see where the loop starts

The code posted starts somewhere after it began. The page loaded, after all, so there couldn't be any syntax errors in it.

Share this post


Link to post
Share on other sites

You're using the part of Bootstrap's styling that sizes boxes. Don't do that.

 

 

:facewall:

 

Always looking for something more significant and it was the easiest thing. 

 

-Thanks

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  



×

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.