MY CODE WITH SC,
php that includes library:
$v_companycode = 123;
sc_include_library(“prj”, “stripe”, “checkout/checkout.php”, true, true);
php included:
if(isset($v_companycode))
{
echo "Company: " . $v_companycode;
}else{
echo “Has no value”;
}
Returns: “Has no value”
USING NATIVE PHP,
php that includes library:
$v_companycode = 123;
include_once ‘…/_lib/libraries/grp/stripe/checkout/checkout.php’;
php included:
if(isset($v_companycode))
{
echo "Company: " . $v_companycode;
}else{
echo “Has no value”;
}
Returns: “123”
The code of a library included in PHP has access to all the variables previously defined in the script that makes the call to include, include_once or require. The sc_include_library macro does not respect this. Try this simple code above.