Showing a Report in the Viewer
Our sample projects and report templates can help you learn the basics of working with our products.The Reports.PHP viewer is created on the server with the PHP SDK, which outputs the JavaScript viewer into the page.
Viewer setup. Configure the viewer, load the report, assign it to the component, and process the requests or events raised by the UI.
Viewer setup. Configure the viewer, load the report, assign it to the component, and process the requests or events raised by the UI.
$viewer = new StiViewer();
$viewer->javascript->relativePath = '../';
$viewer->process();
$report = new StiReport();
$report->loadFile('../reports/SimpleList.mrt');
$viewer->report = $report;
$viewer->printHtml();new StiViewer()— creates the server-side viewer object that generates the client-side JavaScript viewer.javascript->relativePath— points to the folder containing the Stimulsoft scripts, relative to the current page.process()— handles the AJAX requests the viewer makes back to the server (data, print, export).loadFile()— loads an.mrtreport template into the report object.printHtml()— outputs the complete viewer — both the scripts and the viewer body — to the page.
process() handles the AJAX requests the viewer makes, loadFile loads a template, and printHtml() outputs the complete viewer HTML. The report is rendered in the browser by the bundled JavaScript engine.