title: codeigniter required to store flashdata in for-each loop
body: <p><img src="https://i.stack.imgur.com/7dFny.png" alt="Image show the content on which operations are performed">    </p>
  
  <p>As shown in image it is content of may page table
  here whatever is in curly braces that is dynamic content...
  it should be load dynamically...</p>
  
  <p>if it is page then it should go for that page content and it may happen that page contains dynamic content too...</p>
  
  <p>Now, for recursive call of that <strong>i want to store that data in <code>flash data</code> temporary</strong> but that is in <code>foreach loop</code> and may be more than one page need to load in <code>flash data</code> with name page......
  what should i do...??</p>
  
  <p>is there is another way to do this...??
  please help me thank you...</p>
  
  <pre><code>public function page($page = 'home') {
      $text = $data['page']['content'];
      $regex = '/{\K[^}]*(?=})/m';
      preg_match_all($regex, $text, $matches);
      print_r($matches);
      exit;
      if ($matches) {
          foreach ($matches[0] as $value) {
              $menu[] = $value;
              $v1 = explode(':', $value);
              if ($v1[0] == 'page') {
                  $data['page'] = $this-&gt;page($v1[1]);
                  $this-&gt;session-&gt;set_flashdata('page', $data['page']);
              } else if ($v1[0] == 'menu_list') {
                  $data["menu"] = $this-&gt;pages_model-&gt;get_menu($v1[1]);
          } else if ($v1[0] == 'partial')
                  $data["partial"] = $this-&gt;pages_model-&gt;get_partial($v1[1]);
              else {
  
              }
              if (isset($data['page'])) {
              } else if (isset($data['menu'])) {
  
              } else if (isset($data['partial'])) {
  
              }
          }
      } else {
  
      }
      //print_r($data);
      return $this-&gt;load-&gt;view('pages', $data);
  }
  </code></pre>