@Musasi1500 (斎藤 聖人)

Are you sure you want to delete the question?

If your question is resolved, you may close it.

Leaving a resolved question undeleted may help others!

We hope you find it useful!

SmartyテンプレートでJavaScriptの関数が呼び出せない

smartyで作るテンプレートで、ボタンをクリックしたらJavaScriptの関数が呼び出される機能を作っています。
しかし、Samrtyのエラーが発生して次のように我慢に表示されます。

エラーコードーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー
Fatal error: Uncaught --> Smarty: 1():Missing '$template' parameter <-- thrown in C:\xampp\php_libs\smarty\libs\sysplugins\smarty_internal_templatebase.php on line 154

テンプレート(一部抜粋)ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー

<td><button onclick="(function() { let val = {$item.gaihaku_id|cat:'overlay'}; dispEntire(val); } )();">全体表示</button></td>

JavaScript(一部抜粋)ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー
function dispEntire(id){

const overlay = document.getElementById(id);
console.log('実装');
overlay.classList.remove('overlay-off');
overlay.classList.add('overlay-on');

コンソールには何も表示されません。同じようなボタンとJavaScript関数も用意しているんですがそちらは正常に動作します。どうしたらよいでしょうか?

0 likes

1Answer

コンソールで要素を見たところ文字列が””で囲まれておらず変数代入みたいになっていてうまく動いていませんでした。

0Like

Your answer might help someone💌