Ok so, I might be close. Looking at a page on my site I came up with the minimal code needed is this:
Code:
<?php
define('THIS_SCRIPT', 'Simple Page');
$specialtemplates = array();
$phrasegroups = array();
$globaltemplates = array('shell_blank');
require_once('./global.php');
// ################## content ###################
$html = "Type anything you want here";
// ################## build ####################
$navbits[] = 'Simple Page';
$navbits = construct_navbits($navbits);
$navbar = render_navbar_template($navbits);
$templater = vB_Template::create('shell_blank');
$templater->register_page_templates();
$templater->register('html', $html);
$templater->register('navbar', $navbar);
print_output($templater->render());
?>
And that works great for a basic HTML setup, but when I tried including a jquery grid I don't know a way to have it just execute the main render command and assign it to the $html variable so it is put in the right spot. The output of all the other code looks like this:
http://workshopwarrior.com/grid/suppliers.php which is supposed to be in the template.
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<link rel="stylesheet" type="text/css" media="screen" href="./themes/redmond/jquery-ui-custom.css" />
<link rel="stylesheet" type="text/css" media="screen" href="./themes/ui.jqgrid.css" />
<link rel="stylesheet" type="text/css" media="screen" href="./themes/ui.multiselect.css" />
<style type="text">
html, body {
margin: 0; /* Remove body margin/padding */
padding: 0;
overflow: hidden; /* Remove scroll bars on browser window */
font-size: 75%;
}
</style>
<script src="./js/jquery.js" type="text/javascript"></script>
<script src="./js/i18n/grid.locale-en.js" type="text/javascript"></script>
<script type="text/javascript">
$.jgrid.no_legacy_api = true;
$.jgrid.useJSON = true;
</script>
<script src="./js/jquery.jqGrid.min.js" type="text/javascript"></script>
<script src="./js/jquery-ui-custom.min.js" type="text/javascript"></script>
<?php
define('THIS_SCRIPT', 'Supplier Grid');
$specialtemplates = array();
$phrasegroups = array();
$globaltemplates = array('shell_blank');
require_once('./global.php');
// ########################## content ##############################
ini_set("display_errors",1);
require_once '/var/www/workshopwarrior.com/grid/config.php';
// include the driver class
require_once "/var/www/workshopwarrior.com/grid/php/jqGridPdo.php";
// include the jqGrid Class
require_once "/var/www/workshopwarrior.com/grid/php/jqTreeGrid.php";
// Connection to the server
$conn = new PDO(DB_DSN,DB_USER,DB_PASSWORD);
// Tell the db that we use utf-8
$conn->query("SET NAMES utf8");
// Create the jqTreeGrid instance
$tree = new jqTreeGrid($conn);
$tree->SelectCommand = "SELECT * FROM suppliers";
// set the table and primary key
$tree->table = 'suppliers';
$tree->setPrimaryKeyId('id');
// set tree model and table configuration
$tree->setTreeModel('adjacency');
$tree->setTableConfig(array('id'=>'id', 'parent'=>'parent_id'));
// autoloading is disabled
$tree->autoLoadNodes = false;
// collapse all nodes (default)
$tree->expandAll = true;
// show any error (if any ) from server
$tree->showError = true;
$tree->setColModel();
$tree->setUrl('treegrid.php');
$tree->dataType = 'json';
// Some nice setting
$tree->setColProperty('name',array("label"=>"<b>Name</b>", "width"=>470));
$tree->setColProperty('street',array("label"=>"Street Address", "width"=>270));
$tree->setColProperty('city',array("label"=>"City", "width"=>150, "align"=>"center"));
$tree->setColProperty('state',array("label"=>"State", "width"=>60, "align"=>"center"));
$tree->setColProperty('zip',array("label"=>"Zip", "width"=>70, "align"=>"center"));
$tree->setColProperty('phone',array("label"=>"Phone Number", "width"=>170, "align"=>"center"));
$tree->setColProperty('url',array("label"=>"Website", "width"=>370, "align"=>"center", "formatter"=>"link"));
// hide the not needed fields
$tree->setColProperty('id',array("hidden"=>true));
$tree->setColProperty('parent_id',array("hidden"=>true));
$tree->setColProperty('description',array("hidden"=>true));
$tree->setColProperty('category',array("hidden"=>true));
$tree->setColProperty('product',array("hidden"=>true));
// and finaly set the expand column and height to auto
$tree->setGridOptions(array(
"ExpandColumn"=>"name",
"height"=>'auto',
"width"=>1100,
"sortname"=>"id",
"sortable"=>true,
// allow automatic scrolling of the rows
"scrollrows"=>true
));
// enable key navigation
$tree->callGridMethod('#tree', 'bindKeys');
$tree->navigator = true;
$tree->setNavOptions('navigator', array("add"=>true,"edit"=>true, "del"=>true, "search"=>true, "excel"=>true));
$tree->renderTree('#tree', '#pager', true,null, null, true, true);
if($tree->oper == 'edit') {
$data = $_POST;
// $data is the posted data
// do what you want with it
$post_data = json_encode($data, JSON_FORCE_OBJECT);
$json_data = "[";
$json_data .= $post_data;
$json_data .= "]";
file_put_contents("json.txt", $json_data);
}
// build
$navbits[] = 'Supplier Grid';
$navbits = construct_navbits($navbits);
$navbar = render_navbar_template($navbits);
$templater = vB_Template::create('shell_blank');
$templater->register_page_templates();
$templater->register('html', $html);
$templater->register('navbar', $navbar);
print_output($templater->render());
?>