title: Codeigniter Calendar : Adding Specific Data to A Cell
body: <p>Here is my problem,</p>
  
  <p>I need to show all the people with birthdays with the selected month, I already got on how to put the data on the specific, table cells, the only problem is that the data is also appearing on other tables cells which it is not intended. On the figure below <code>Ori Hendricks</code> must only be on <code>2</code> but it appears on other cells.</p>
  
  <p><img src="https://i.stack.imgur.com/ftV7G.png" alt="enter image description here"></p>
  
  <p><strong>Here is the data for the calendar</strong></p>
  
  <pre><code>Array
  (
      [2] =&gt; Array
          (
              [0] =&gt; Nomlanga Bentley**81
              [1] =&gt; Ori Hendricks**325
          )
  
      [5] =&gt; Array
          (
              [0] =&gt; Rina Nash**161
          )
  
      [10] =&gt; Array
          (
              [0] =&gt; Gary Mullins**252
          )
  
      [12] =&gt; Array
          (
              [0] =&gt; Nissim Donovan**207
          )
  
      [13] =&gt; Array
          (
              [0] =&gt; Harper Trevino**380
          )
  
      [14] =&gt; Array
          (
              [0] =&gt; Sacha Arnold**167
              [1] =&gt; Wade Hughes**322
              [2] =&gt; Brennan Long**3
          )
  
      [15] =&gt; Array
          (
              [0] =&gt; Gary Hart**290
          )
  
      [21] =&gt; Array
          (
              [0] =&gt; Alisa Bowman**201
          )
  
      [22] =&gt; Array
          (
              [0] =&gt; Dustin Meyers**330
          )
  
      [26] =&gt; Array
          (
              [0] =&gt; Ifeoma Swanson**331
          )
  
      [28] =&gt; Array
          (
              [0] =&gt; McKenzie Norton**327
              [1] =&gt; Asher Rasmussen**47
          )
  
      [29] =&gt; Array
          (
              [0] =&gt; Branden Conway**7
              [1] =&gt; Luke Sullivan**176
          )
  
      [30] =&gt; Array
          (
              [0] =&gt; Slade Moon**16
          )
  
  )
  </code></pre>
  
  <p>Iv'e created a <code>MY_calendar</code> class and created my own generator,here is the relevant code for showing the data on the cells</p>
  
  <pre><code>if (isset($data[$day]))
  {
      // Cells with content
      $temp = ($is_current_month == TRUE AND $day == $cur_day) ? $this-&gt;temp['cal_cell_content_today'] : $this-&gt;temp['cal_cell_content'];
      if(is_array($data[$day]))
      {       
          foreach($data[$day] as $k =&gt; $v)
          {
              $name = substr($v,0,strpos($v,'**'));
              $student_enrollment_id = substr($v,strpos($v,'**')+2);
              $data_formatted[$k] = '&lt;a href="'.site_url('profile/student/'.$student_enrollment_id).'" target="_blank" class="btn btn-mini"&gt;'.trim($name).'&lt;/a&gt;';
          }
          $data_from_array = implode('',$data_formatted);
  
          $out .= str_replace('{day}', $day, str_replace('{content}', $data_from_array, $temp));
      }else{
          $out .= str_replace('{day}', $day, str_replace('{content}', $data[$day], $temp));
      }
  }
  else
  {
      // Cells with no content
      $temp = ($is_current_month == TRUE AND $day == $cur_day) ? $this-&gt;temp['cal_cell_no_content_today'] : $this-&gt;temp['cal_cell_no_content'];
      $out .= str_replace('{day}', $day, $temp);
  }
  </code></pre>
  
  <p>i don't have any other idea how to do this, please help.</p>