After using Scriptcase for about a year I have started to work with accessing External Libraries. I am a visual person and finding it difficult to locate a good tutorial that goes through the steps of referencing an External Library. Does SC have an example of this?
The instructions and blogs do mention some things, but when I look at documentation for an External library I can’t tell if I should place their code to initialize the reference in ScriptInt or ApplicationInit.
This is what I have so far:
I am using PHPSpreadsheet-1.3.1. I have installed and enabled the library in Scriptcase 9.2.
In ScriptInt:
?>
<link rel=“stylesheet” type=“text/css” href="<?php echo sc_url_library(‘prj’, ‘PHPSpreadsheet’, ‘PhpSpreadsheet-1.3.1/src/PhpSpreadsheet/style/style.php’);?>">
<?php
I created a test button called “Import” to see if the library works:
Button_Import
require ‘vendor/autoload.php’;
use PHPSpreadsheet\Spreadsheet;
use PHPSpreadsheet\Writer\Xlsx;
$spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet();
$sheet->setCellValue(‘A1’, ‘Hello World !’);
$writer = new Xlsx($spreadsheet);
$writer->save(‘hello world.xlsx’);
When I run the app I get the following error:
Parse error: syntax error, unexpected ‘use’ (T_USE) in D:\Development\NetMake\v9\wwwroot\scriptcase\app\PersonalFinances\control\control_apl.php on line 1328
The error points to the first use statement in the Button_Import code listed above.
Any ideas anyone. Thank you for the assistance in advance.