Showing a Dashboard in the Viewer in an HTML template
Our sample projects and report templates can help you learn the basics of working with our products.The viewer can be placed inside your own HTML template by emitting its scripts in the head and its markup in the body.
Render the script and HTML parts separately.
How it works. Splitting the component into script and body lets the dashboard viewer sit inside any custom page layout.
Render the script and HTML parts separately.
$viewer = new StiViewer();
$viewer->options->height = '800px';
$viewer->process();
$report = new StiReport();
$report->loadFile('../reports/Christmas.mrt');
$viewer->report = $report;
// In <head>: $viewer->javascript->renderHtml();
// In <body>: $viewer->renderHtml();$viewer->javascript->renderHtml()— the viewer's script block, placed in the page head.$viewer->renderHtml()— the viewer's visual HTML, placed wherever you want it in the body.
How it works. Splitting the component into script and body lets the dashboard viewer sit inside any custom page layout.