Created
September 13, 2023 19:39
-
-
Save gridphp/e2634bf95e3681181c6f4d6692df9942 to your computer and use it in GitHub Desktop.
Codeigniter4 Integration Code Sample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Controllers; | |
class Home extends BaseController | |
{ | |
public function index() | |
{ | |
$db_conf = array(); | |
$db_conf["type"] = "mysqli"; // mysql,oci8(for oracle),mssql,postgres,sybase | |
$db_conf["server"] = "127.0.0.1"; | |
$db_conf["user"] = "root"; | |
$db_conf["password"] = ""; | |
$db_conf["database"] = "griddemo"; | |
require_once(ROOTPATH."public/lib/inc/jqgrid_dist.php"); | |
$g = new \jqgrid($db_conf); | |
$grid = array(); | |
// set table for CRUD operations | |
$grid["caption"] = "CodeIgniter Datagrid"; | |
$g->set_options($grid); | |
// render grid | |
$g->table = "customers"; | |
$data['grid'] = $g->render("list1"); | |
return view('welcome_message',$data); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Welcome to CodeIgniter 4!</title> | |
<meta name="description" content="The small framework with powerful features"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<link rel="shortcut icon" type="image/png" href="/favicon.ico"/> | |
<link rel="stylesheet" type="text/css" media="screen" href="lib/js/themes/base/jquery-ui.custom.css"></link> | |
<link rel="stylesheet" type="text/css" media="screen" href="lib/js/jqgrid/css/ui.jqgrid.css"></link> | |
<script src="lib/js/jquery.min.js" type="text/javascript"></script> | |
<script src="lib/js/jqgrid/js/i18n/grid.locale-en.js" type="text/javascript"></script> | |
<script src="lib/js/jqgrid/js/jquery.jqGrid.min.js" type="text/javascript"></script> | |
<script src="lib/js/themes/jquery-ui.custom.min.js" type="text/javascript"></script> | |
</head> | |
<body> | |
<section> | |
<div style="margin:10px"> | |
<?php echo $grid?> | |
</div> | |
</section> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment