アプリを移植する際、bodyタブに記述した内容から、定数を書き換える必要が生じました。 ・pages「p014792」、block-name「fcb03716」、record「6」、など これらの定数書き換えを不要にする方法はありますか? (例えば、定義、定数名、変数名、を利用するなど。) (body記述例1) <!-- body以下の要素を記述してください --> <a th:if="${siteClient.record[6] != null}" th:href="|${pages['p014792']?.path ?: '/404'}?${siteClient.record[6].linkParam}|" th:text="${pages['p014792']?.title ?: pages['p014792']?.displayName ?: '404'}"></a> <sp:block name="fcb03716"></sp:block> <sp:block name="fcb03708"></sp:block> (body記述例2) <!-- body以下の要素を記述してください --> <th:block th:if="${cp.result.value['p_group'] eq #strings.toString(siteClient.record[4]['_id'])}"> <sp:block name="ifb03453"></sp:block> </th:block> <th:block th:if="${cp.result.value['p_group'] ne #strings.toString(siteClient.record[4]['_id'])}"> 処理できません </th:block> <sp:block name="fcb03742"></sp:block>
コメント
お問い合わせいただき、ありがとうございます。 >pages「p014792」、block-name「fcb03716」、record「6」、など >これらの定数書き換えを不要にする方法はありますか? アプリを移植する際、bodyタブに記述された定数部分を都度書き換える必要があるケースがございます。 これらの定数については、PHP側で変数として定義することで、定数書き換えを不要にすることが可能です。 ■PHP側の記載イメージ <?php $SPIRAL->setTHValue("fid1","f01"); ■ブロック側の記載イメージ 差し替え前: <input type="text" class="sp-form-control" th:name="${fields['f01'].name}" th:placeholder="${fields['f01'].placeholder}"th:value="${inputs['f01']}"th:if="${fields['f01'].control == 'text'}"> ↓ 差し替え後: <inputtype="text"class="spformcontrol"th:name="${fields[cp.result.value['fid1']].name}" th:placeholder="${fields[cp.result.value['fid1']].placeholder}"th:value="${inputs[cp.result.value['fid1']]}" th:if="${fields[cp.result.value['fid1']].control == 'text'}"> ■PHPの値をThymeleafで使用する方法 https://support.spiral-platform.com/function/function-site-manage/6898.html#setTHValuekey_value
■注意点 標準の使用方法ではないため、すべてのブロックやページなどで動作が保証されているわけではありません。 また、「siteClient.record[x]」など一部動作しないものもございますので、 ご利用の際は正しく動作することを確認の上ご利用ください。 ■補足 同じ設定を複製する場合でしたら、 アプリ・サイトのエクスポート/インポート機能をご利用ください。 サイトは別になってしまいますが、 アプリインポート時にエクスポート時と同じフィールドコードで発行される仕様なっております。 また、ページやブロックも差替えされた状態で発行されますので、 サイトインポートの際にページやブロック、フィールドコードの変更は不要となります。 ご確認のほどよろしくお願いいたします。
ベストアンサー
ナレッジ
向上チーム
お問い合わせいただき、ありがとうございます。 >pages「p014792」、block-name「fcb03716」、record「6」、など >これらの定数書き換えを不要にする方法はありますか? アプリを移植する際、bodyタブに記述された定数部分を都度書き換える必要があるケースがございます。 これらの定数については、PHP側で変数として定義することで、定数書き換えを不要にすることが可能です。 ■PHP側の記載イメージ <?php $SPIRAL->setTHValue("fid1","f01"); ■ブロック側の記載イメージ 差し替え前: <input type="text" class="sp-form-control" th:name="${fields['f01'].name}" th:placeholder="${fields['f01'].placeholder}"th:value="${inputs['f01']}"th:if="${fields['f01'].control == 'text'}"> ↓ 差し替え後: <inputtype="text"class="spformcontrol"th:name="${fields[cp.result.value['fid1']].name}" th:placeholder="${fields[cp.result.value['fid1']].placeholder}"th:value="${inputs[cp.result.value['fid1']]}" th:if="${fields[cp.result.value['fid1']].control == 'text'}"> ■PHPの値をThymeleafで使用する方法 https://support.spiral-platform.com/function/function-site-manage/6898.html#setTHValuekey_value
2025年12月22日(月)