0
所以我有一個getResources打電話給我這個電話的整數值:優化我的Modx片段與getresources調用內部我的代碼片段,而不是外部?
[[!getResources? &parents=`[[*id]]` &totalVar=`totalLinks`]]
輸出到[[+ totalLinks]我用它來輸入到我的片段
[[!ChangeNumberToWord? &input=`[[+totalLinks]]`]]
我的代碼段:
$input = '';
function converttoword($total){
if ($total=="1"){
$word = "one";
} elseif($total=="2") {
$word = "two";
} elseif($total=="3") {
$word = "three";
} elseif($total=="4") {
$word = "four";
} elseif($total=="5") {
$word = "five";
} elseif($total=="6") {
$word= "six";
} elseif($total=="7") {
$word ="seven";
} elseif($total=="8") {
$word = "eight";
} else{
$word = "$total";
}
return $word;
}
$output = converttoword($input);
return $output;
我的問題是我如何粘合這2個,所以我只需要調用我的代碼段?
感謝這個,這將讓我去! – TVD 2014-09-27 17:38:47
如果它有效,您應該將其標記爲答案。 – 2014-09-27 17:57:19