"$" is a speical and default tag served as a prefix marker for a variable in Hanjst.
Try to call a func named 'aFunc' and display its return:
{$aFunc($i)}
"aFunc" is an user-defined function with JavaScript.
"$aFunc($i)" is to call aFunc and display its return value.
Similarly, "$alist[$i]" or "$alist[$i][$j]" is to display an element with $i as its key in a hash or array object.
Call a built-in func:
{$jstr.substring(0, 12)}
"substring" is a built-in function for JavaScript.
"jstr" is a variable from server response, which will be accessed via $jstr.
"$jstr" is to display the variable "jstr".
"$jstr.substring(0, 12) is to shorten the string for first 12 bytes and/or chars, then display the modified $jstr.
Give random numbers with while:
{while $i<5}
line {$i}
{$i++}
{whileelse}
Out of While.
{/while}
....
2nd, try to list an associative list:
{for var $k in $userlist}
{if $titleLength > 50}
{$titleLength} is greater than 50!
{else if $titleLength > 10}
{$titleLength} is greater than 10!
{else}
{$titleLength} is less than 10!
{/if}
{$strArr2=Object.values($strArr)}
Position of 1-b in {"0":"0-a", "1":"1-b"}: [{$strArr2.indexOf("1-b")}]
Set undefined $aaBbList['a'] to empty:[{$aaBbList['a']}]
$i: {$i} , $i*2: {=$i*2}
Hanjst汉吉斯特更新记录/Update History
{literal}
* @Since July 07, 2016, refactor on Oct 10, 2018
* Nov 24, 2018, +include with scripts
* Dec 02, 2018, +variables, +functions
* Dec 04, 2018, +tpl2code string to array, +foreach
* Dec 08, 2018, +else if, +embedded tpl in <>
* Dec 16, 2018, +literal
* Jan 01, 2019, +foreachelse, forelse, whileelse
* Fri Jan 4 03:59:42 UTC 2019, +remedyMemoLine
* Fri Jan 11 13:48:28 UTC 2019, +codes refine
* Tue Jan 15 11:53:30 UTC 2019, remove html comments, imprvs with appendScript
* Mon Feb 11 06:18:18 UTC 2019, +callRender
* 13:54 Friday, April 19, 2019, + check for undefined $xxx
* 12:48 Saturday, April 27, 2019, + readable error reporting for template erros
* 19:19 Sunday, May 19, 2019, + renderTemplateRecurse for deep-in include files.
* 18:44 Friday, May 31, 2019, + allow limited support for variables in xxxelse scope, bugfix for includeScript.
* 07:58 6/2/2019, + imprvs with _appendScript to appendScript for async call.
* 16:31 Wednesday, June 5, 2019, + imprvs with parentNode=BODY
* 19:18 Monday, June 10, 2019, + bugfix for asyncScripts.
* 22:29 Thursday, June 13, 2019, + loadingLayer. "<div id="Hanjstloading" style="width: 100%; height: 100%; z-index: 99;"> Xxxx Loading... 加载中... </div>" .
* 21:36 Thursday, June 20, 2019, + warning for MSIE browsers.
* Sun Nov 24 11:50:36 CST 2019, + undefined exceptions.
* 10:12 Monday, December 2, 2019, + time_stamp.
* 10:34 Friday, April 10, 2020, + func showImageAsync
* 17:49 Wednesday, May 20, 2020, + _enSafeExpr.
* 09:52 Thursday, June 4, 2020, + import jsonDataId with script.
* 11:42 6/11/2020, + {=$i+2} support.
* 21:42 2020-09-01, imprvs for regExp for remedyMemoLine.
* 09:08 2021-03-17, imprvs for debug in mobile browsers, +support for if conditionExpr
* 17:09 2021-04-26, + _enSafeExprAsCondition .
* 21:32 2021-05-19, bugfix for remedyMemoLine .
* 12:31 2021-05-21, bugfix for & .
* 09:04 2021-06-07, add more _enSafeExpr .
* 21:51 2021-06-29, +comment: use Firefox to figure out exact error lineNumber and columnNumber in tpl2code in new Function
* 21:55 2021-11-11, imprvs for remedyMemoLine
* 11:37 2022-01-13, bugfix for remedyMemoLine, v2.7
* 08:09 2022-06-04, imprvs for delay more time for async scripts, v2.8
* 22:14 2022-06-07, +asyncScripti for async include scripts embedded, v2.9
{/literal}
{include content="$pagefooter"}