• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
passing data to footer

#1
[eluser]handoyo[/eluser]
Hi all,i'm trying to load data(online store phone number) to footer.

I got controller for home like this

controller/home.php
Code:
function index()
    {  
        $data['title'] = "Selamat datang di 7Com";
        $data['navlist'] = $this->MCat->getkategoriNav();
                //this is the data i want to load to footer
        $data['konfigurasi'] = $this->MConfig->getAllConf();
        $data['main'] = 'home/index';
        $this->load->vars($data);
        $this->load->view('template',$data);
    }

view/template.php
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
&lt;html &gt;
&lt;head&gt;
  &lt;meta http-equiv="content-type" content="text/html; charset=utf-8" /&gt;
  &lt;title&gt;&lt;?php echo $title; ?&gt;&lt;/title&gt;
&lt;link href="&lt;?= base_url();?&gt;css/default.css" rel="stylesheet" type="text/css" /&gt;
<noscript>
Javascript is not enabled! Please turn on Javascript to use this site.
</noscript>

[removed]
//&lt;![CDATA[
base_url = '&lt;?= base_url();?&gt;';
//]]>
[removed]
[removed][removed]
[removed][removed]
[removed][removed]
&lt;/head&gt;
&lt;body&gt;
<div id="wrapper">
  <div id="header">
  &lt;?php $this->load->view('header');?&gt;
  </div>
  <div id="nav">
  &lt;?php $this->load->view('navigation');?&gt;
  </div>
  <div id="main">
  &lt;?php $this->load->view($main);?&gt;
  </div>
  <div id="footer">
  &lt;?php $this->load->view('footer');?&gt;
  </div>
</div>
&lt;/body&gt;
&lt;/html&gt;

view/footer.php
Code:
Copyright &lt;?php echo date("Y"); ?&gt;
&lt;?php echo anchor("welcome/pages/privacy","privacy policy");?&gt;
&nbsp;&nbsp;&nbsp;
&lt;?php echo anchor("login","dashboard");?&gt;

How should i pass the data for example $konfigurasi['store_phone_number'] to footer so i can put it in the footer ?Thanks a lot..

#2
[eluser]imn.codeartist[/eluser]
Try this in your footer

view/footer.php

Code:
Copyright &lt;?php echo date("Y"); ?&gt;
&lt;?php echo anchor("welcome/pages/privacy","privacy policy");?&gt;
&nbsp;&nbsp;&nbsp;
&lt;?php echo anchor("login","dashboard");?&gt;


//Added Code
&lt;?
$konfigurasi = $this->MConfig->getAllConf();
echo $konfigurasi[‘store_phone_number’];
?&gt;
//

#3
[eluser]handoyo[/eluser]
Ok dix coder.Thanks a lot..I'll try it.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.