Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---------------------------controller--------------------
- public function index()
- {
- $content['query'] = $this->home_model->lihat_home();
- if($content['query']) {
- $profile['query'] = $this->home_model->lihat_profile();
- $profile['query1'] = $this->home_model->contact();
- if($profile['query']) {
- $slide['query'] = $this->gambar_model->lihat_front();
- if($slide['query']) {
- $array = array('home' => $this->load->view('home',$content,true),
- 'profile' => $this->load->view('profile',$profile,true),
- 'contact' => $this->load->view('contact', '',true),
- 'register' => $this->load->view('register', '',true),
- 'slide' => $this->load->view('slide', $slide,true) );
- $this->load->view('index', $array);
- } } }
- }
- -------------------model-------------------
- function lihat_profile() {
- $this->db->order_by('id_berita','DESC');
- $array = array( 'jenis' => 'profile', 'status' => '1');
- $this->db->where($array);
- $query = $this->db->get('berita');
- return $query->result();
- }
- function contact(){
- $query=mysql_query("SELECT facebook, twitter, email, ym FROM contact")or die(mysql_error());
- return $query;
- }
- --------------view--------------------
- <body>
- <?php
- foreach ($query as $row1){
- echo "<div class='one'><div>";
- ?>
- <img align="left" src="<?php echo base_url($row1->path); ?>" />
- <?php
- echo "<h4>".$row1->judul."</h4><br>";
- echo $row1->isi;
- echo "</div><div style='clear:both'></div></div>";
- }
- foreach ($query as $row2){
- echo "<a href='".$row2->facebook."'><img src='".base_url()."img/fb.png'></a>";
- }
- ?>
- </body>
Advertisement
Add Comment
Please, Sign In to add comment