Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] Problem with data passed to view
#1

[eluser]Unknown[/eluser]
I know this has been discussed many times, but I think this might be a new angle - either way I am a bit lost.

I have this controller function:
Code:
public function catalog() {
        $data = array();
        $data['year']='2010';
        $data['page']=$this->uri->segment(3, '1');
        $this->load->view('catalog', $data);
    }

And this view:
Code:
<?=doctype('xhtml11')?>
<html xml:lang="da">
    <head>
        <?php
$data['title'] = $this->config->item('company_name').' :: Fyrværkeri katalog '.$year.' - side '.$page;
        $this->load->view('header',$data);
        ?>
    </head>
    <body>
        <div id="container">
            <div id="content">
                &lt;?=img_teaser(array('img' =>'fireworks/'.$year.'/fireworks_cat_p' . sprintf("s", $page). '.jpg',
                                          'more'=>'Text',
                                          'head'=>'',
                                          'txt'=>'Page '.$page,
                                          'wid'=>'250'
                                        ))?&gt;
                <div>/div>
            </div>
        </div>
    &lt;/body&gt;
&lt;/html&gt;

I have other view that operates on the same logic without problems, but this particular view doesn't recognize $year and $page.

Only difference I can think of, is that this controller is called from a link with a target=new to open a new window.

Anyone has an idea about what is wrong here?

Best regards
Carsten
CI newbie




Theme © iAndrew 2016 - Forum software by © MyBB