Skip to main content
added 460 characters in body
Source Link

I'll give you a hint. Try using a foreach loop: http://www.php.net/manual/en/control-structures.foreach.php

You can store all your files and associated information in an associative array, such as:

$files = array(
  0 => array(
    'filename' => "export_file_system_status_output";   
    'status_update' => "online";
  ),
  1 => array(
    'filename' => "another_file";   
    'status_update' => "offline";
  )
);

You should really try this on your own :) If you don't get it, I'll give you a more complete answer :)

On a side note, your HTML is not valid. Use classes instead of ids when possible, and use quotes:

<div class="badge_subpage_system">
  <h5>#performancedegradation</h5>
  <p>Performance is slower than normal.</p>
</div>

Hope this helps :)

EDIT:

Here's what your final code will look like, with the array I posted above:

foreach($files as $file)
{
  $handle = fopen($file['filename'], "r");
  $file = fread($handle,filesize($file['filename']));
  if (preg_match('#' . $file['status_update'] . '#', $file, $match))
  {
    echo '<div id="badge_subpage_system"><h5>#performancedegradation</h5><p>Performance is slower than normal.</p></div>';
  }
}

I'll give you a hint. Try using a foreach loop: http://www.php.net/manual/en/control-structures.foreach.php

You can store all your files and associated information in an associative array, such as:

$files = array(
  0 => array(
    'filename' => "export_file_system_status_output";   
    'status_update' => "online";
  ),
  1 => array(
    'filename' => "another_file";   
    'status_update' => "offline";
  )
);

You should really try this on your own :) If you don't get it, I'll give you a more complete answer :)

On a side note, your HTML is not valid. Use classes instead of ids when possible, and use quotes:

<div class="badge_subpage_system">
  <h5>#performancedegradation</h5>
  <p>Performance is slower than normal.</p>
</div>

Hope this helps :)

I'll give you a hint. Try using a foreach loop: http://www.php.net/manual/en/control-structures.foreach.php

You can store all your files and associated information in an associative array, such as:

$files = array(
  0 => array(
    'filename' => "export_file_system_status_output";   
    'status_update' => "online";
  ),
  1 => array(
    'filename' => "another_file";   
    'status_update' => "offline";
  )
);

You should really try this on your own :) If you don't get it, I'll give you a more complete answer :)

On a side note, your HTML is not valid. Use classes instead of ids when possible, and use quotes:

<div class="badge_subpage_system">
  <h5>#performancedegradation</h5>
  <p>Performance is slower than normal.</p>
</div>

Hope this helps :)

EDIT:

Here's what your final code will look like, with the array I posted above:

foreach($files as $file)
{
  $handle = fopen($file['filename'], "r");
  $file = fread($handle,filesize($file['filename']));
  if (preg_match('#' . $file['status_update'] . '#', $file, $match))
  {
    echo '<div id="badge_subpage_system"><h5>#performancedegradation</h5><p>Performance is slower than normal.</p></div>';
  }
}
Source Link

I'll give you a hint. Try using a foreach loop: http://www.php.net/manual/en/control-structures.foreach.php

You can store all your files and associated information in an associative array, such as:

$files = array(
  0 => array(
    'filename' => "export_file_system_status_output";   
    'status_update' => "online";
  ),
  1 => array(
    'filename' => "another_file";   
    'status_update' => "offline";
  )
);

You should really try this on your own :) If you don't get it, I'll give you a more complete answer :)

On a side note, your HTML is not valid. Use classes instead of ids when possible, and use quotes:

<div class="badge_subpage_system">
  <h5>#performancedegradation</h5>
  <p>Performance is slower than normal.</p>
</div>

Hope this helps :)