codeigniter required to store flashdata in for-each loop

370 views Asked by At

Image show the content on which operations are performed

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...

if it is page then it should go for that page content and it may happen that page contains dynamic content too...

Now, for recursive call of that i want to store that data in flash data temporary but that is in foreach loop and may be more than one page need to load in flash data with name page...... what should i do...??

is there is another way to do this...?? please help me thank you...

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->page($v1[1]);
                $this->session->set_flashdata('page', $data['page']);
            } else if ($v1[0] == 'menu_list') {
                $data["menu"] = $this->pages_model->get_menu($v1[1]);
        } else if ($v1[0] == 'partial')
                $data["partial"] = $this->pages_model->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->load->view('pages', $data);
}
0

There are 0 answers