| Support Center

(Back to Website)

Support Center

Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

Integrate with codeigniter

c3media Jan 08, 2018 12:47AM PKT

Hello, I'm trying to integrate with codeigniter so:

Controller:

<?php

class Segway extends MY_Controller
{


function __construct()
{
parent::__construct();

if (!$this->loggedIn) {
$this->session->set_userdata('requested_page', $this->uri->uri_string());
$this->sma->md('login');
}
if (!$this->Owner && !$this->Admin) {
$this->session->set_flashdata('warning', lang('access_denied'));
redirect($_SERVER["HTTP_REFERER"]);
}
}

public function index()
{
// $this->load->view('welcome_message');

require_once(APPPATH. 'libraries/phpgrid/config.php'); // APPPATH is path to application folder
// Database config file to be passed in phpgrid constructor
$db_conf = array(
"type" => PHPGRID_DBTYPE,
"server" => PHPGRID_DBHOST,
"user" => PHPGRID_DBUSER,
"password" => PHPGRID_DBPASS,
"database" => PHPGRID_DBNAME
);

$g = new jqgrid($db_conf);

$grid["caption"] = "Sample Grid";
$g->set_options($grid);
$g->table = "clients";

$out = $g->render("list1");

$this->load->view('show_grid',$out);
}

?>

View:

<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Show Grid</title>
</head>
<body>

<div id="container">
<h1>Welcome to CodeIgniter! Show me the grid!</h1>

<div id="body">
<?php echo $out?>
</div>

</div>

</body>
</html>

I have used tutorial to try to integrate it:
https://phpgrid.com/example/phpgrid-and-codeigniter-integration/

But not works; Thanks by your help!

Up 0 rated Down
c3media Jan 08, 2018 12:52AM PKT
Sorry I'll try with:
https://gist.github.com/gridphp/272a3063359c8b5938355ed59c7711d4

Thank you!
Up 0 rated Down
c3media Jan 08, 2018 01:02AM PKT
I did it, but show me error:

Unable to load the requested file: default.php

Thanks by your help!
Up 0 rated Down
Abu Ghufran Jan 08, 2018 09:17AM PKT PHP Grid - Support Center Engineer
Hello,

Make sure file is correct and always check php error log for error details. There could be more than one reasons for this.
Up 0 rated Down
c3media Jan 08, 2018 09:27AM PKT
Fine, talk me about where to copy LIB folder?

Thanks!
Up 0 rated Down
Abu Ghufran Jan 08, 2018 06:44PM PKT PHP Grid - Support Center Engineer
Emailed you sample project.

Closing this ticket.
Up -1 rated Down
c3media Jan 09, 2018 09:27AM PKT
Hello Abu,


It's working partially, just because says grid message: No records to view

But i have records here in clients table.

Regards!
Up 0 rated Down
Abu Ghufran Jan 13, 2018 09:26AM PKT PHP Grid - Support Center Engineer
Closing this ticket, duplicate conversation on email.

Post Your Public Answer

Your name (required)
Your email address (required)
Answer (required)

Contact Us

  • Post a Public Question
  • Email Us
  • Live Chat!
  • Ask the Community

    Instructions

    • Paste complete code that is involved in your question. You can use pastebin.com to share code link.

    Screenshots or Online link of webpage is helpful in resolution. You can also send email at address mentioned below.

    • To report an issue, Write steps to regenerate the case.

    • For email support or live chat, Use gridphp@gmail.com and add it in Google Chat.
https://cdn.desk.com/
false
desk
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete