一、ScriptCase 內部使用的區域變數: 用{}刮起來
兩個情形:
1. 欄位 Database Field
2. 語言索引 Language Index
資料庫的欄位在內部視為 區域變數 Local Variables
欄位變數必須在資料庫欄位值被成功載入以後,才會有用
所以,在 onScriptInit Event時是沒有用的。縱使你用了,在資料庫值被載入後,就被變掉了!
$var_local = {application_field};
[variavel_global] = {application_field};
Field type Text: {field_text} = “This is a sample text”;
Field type Number: {field_number} = 100;
Field type Number: {field_number} = 100;
另外一個ScriptCase 的區域變數,語言設定的索引變數,也是用 {} 刮起來
在 control 連結的 外部html form .html裡面,就可以使用 {lang_index_xxxx}
例如: CRM 系統Sample裡的 login index.html
在:Control (HTML) - onApplicationInit 裡面有這行程式:
$year = sprintf({lang_page_copyright}, date('Y'));
{lang_page_copyright} = $year;
在連結的 index.html 最下面有這一段 footer
<div class="copyright">
<p>{lang_page_copyright}123</p>
</div>
然後在 Application language index 設定裡面:
{lang_page_copyright} :英文:
©%d <a target="_blank" href="http://www.scriptcase.net/">Scriptcase</a>. All rights reserved.
二、ScriptCase 整體變數,也就是 Session Variables: [global_variable]
三、php程式的 local variables:$variables
$text = “This variable stores a Text”;
$number = “This variable stores a number”;
$number = “This variable stores a number”;
Global Variables (Session Variables)
These are variables that are stored in the application session, these variables can be used to pass parameters through the applications in the project. These variables can be used at any application event.
Unlike the local and field variables, Global variables can be used in the SQL of the applications that allows the manual to be changed, and in the WHERE Clause of the Form application, thus enabling a dynamic use of the applications.
SQL Grid sample
Sample in the WHERE Clause of the Form
To define a global variable, you only have to enter it in between brackets, for example:
[global_variable].
Assigning value to global variable:
[text_variable] = “This global has a text stored in it”;
[number_variable] = “This global has a number stored in it”;
[number_variable] = “This global has a number stored in it”;
Passing values between applications
To pass values between applications, it is necessary to define the same variable in the applications that will use them, however, in the source application the variable must be defined as Output and in the destination application must be defined as Input.
To change the variable type, go to the menu Application> Global Variables.
After clicking on this menu will show the variables in the application and its settings.
In this configuration screen we have the following configuration options:
Attribute:
In Attributes we can see the variables in our application.
Value:
In Value we can see some options and configurations of our variable.
Type: This option defines whether the variable will be input or output.
Description:
Reports where the variable was declared by the developer.
Local Variables
Local variables are basically PHP’s own variables. These variables must be set using a $ dollar sign at the beginning and the variable names are case-sensitive.
These variables will only work in events or methods, using a variable in an event it will make it only available in that event.
Variable names follow the same rules as other labels in PHP. A valid variable name begins with a letter or underscore, followed by any number of letters, numbers, or underscores.
Below we can see some examples of local variables:
$text = “This variable stores a Text”;
$number = “This variable stores a number”;
$number = “This variable stores a number”;
For more information, visit the php variables.
沒有留言:
張貼留言