Advertisement
cahyadyazin

grocerry

Jun 22nd, 2014
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.89 KB | None | 0 0
  1. ============================= File Controllers : welcome.php ============================
  2.  
  3. <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  4.  
  5.     class Welcome extends CI_Controller {
  6.  
  7.         public function __construct() {
  8.             parent::__construct();
  9.  
  10.             $this->load->database();
  11.             $this->load->helper('url');
  12.  
  13.             $this->load->library('grocery_CRUD');
  14.         }
  15.  
  16.         public function _example_output($output = null) {
  17.             $this->load->view('lihat.php',$output);
  18.         }
  19.  
  20.         public function index() {
  21.             $data['judul'] = "Ini Link CRUD";
  22.             $this->load->view('link.php',$data);
  23.         }
  24.    
  25.         public function crud() {
  26.             $crud = new grocery_CRUD();
  27.  
  28.             //$crud->set_relation('customerNumber','customers','{contactLastName} {contactFirstName}');
  29.             //$crud->display_as('customerNumber','Customer');
  30.             $crud->set_table('nama_tabel');
  31.             $crud->set_subject('Data');
  32.             //$crud->unset_add();
  33.             //$crud->unset_delete();
  34.  
  35.             $output = $crud->render();
  36.             $this->_example_output($output);
  37.         }
  38.     }
  39. ?>
  40.  
  41. ================================ File views : link.php ==================================================
  42. <h1><?php echo $judul; ?></h1>
  43. <a href="<?php echo site_url('welcome/crud');?>">Click</a>
  44.  
  45. ================================= File Views : lihat.php =================================================
  46. <!DOCTYPE html>
  47. <html>
  48. <head>
  49.     <meta charset="utf-8" />
  50. <?php
  51. foreach($css_files as $file): ?>
  52.     <link type="text/css" rel="stylesheet" href="<?php echo $file; ?>" />
  53. <?php endforeach; ?>
  54. <?php foreach($js_files as $file): ?>
  55.     <script src="<?php echo $file; ?>"></script>
  56. <?php endforeach; ?>
  57. <style type='text/css'>
  58. body
  59. {
  60.     font-family: Arial;
  61.     font-size: 14px;
  62. }
  63. a {
  64.     color: blue;
  65.     text-decoration: none;
  66.     font-size: 14px;
  67. }
  68. a:hover
  69. {
  70.     text-decoration: underline;
  71. }
  72. </style>
  73. </head>
  74. <body>
  75.     <div>
  76.         <?php echo $output; ?>
  77.     </div>
  78. </body>
  79. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement