EC-CUBEで、tplファイル内のscriptタグの中でsmartyを実行して、jsの変数に値を格納したいです。
javascript
1// ① 2var test = <!--{$arrProduct[product_id]}-->; 3// ② 4var test = /*<!--{$arrProduct[product_id]}-->*/; 5// ③ 6var test = <!--{php}-->echo $arrProduct['product_id']<!--{/php}-->; 7console.log(test);
③の場合には前もって
<!--{php}--><!--{/php}-->$arrProduct = $this->get_template_vars('arrProduct');
を実行しています。
いずれも値がいきません、何かsmarty的な解決策はありますか?
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。