
Kuroco Server Processing
- 36 installs
- 1 repo stars
- Updated July 27, 2026
- diverta/kuroco-skills
Kuroco Server Processing is an agent skill that maps Kuroco Smarty server-side plugins across API, auth, form, and integration categories.
About
Kuroco Server Processing is an agent skill for developers building on the Kuroco headless CMS who need server-side Smarty plugin behavior documented in one place. Solo builders and small teams wiring custom endpoints, template logic, form flows, and third-party hooks can invoke it when the agent must pick the correct plugin from a large surface area—API internal calls, management APIs, credential assignment, AI completions, embeddings, Firestore activity, and Vue-facing template helpers. The skill is organized as a master index plus category markdown files (API plugins, strings, arrays, forms, auth, integrations, files, Vue), so queries resolve to the right symbol instead of hallucinated Kuroco APIs. It sits on the Build integrations shelf because it assumes an existing Kuroco project and focuses on server template processing, not distribution or analytics. Complexity is advanced due to ecosystem size and bilingual doc context; confidence reflects strong readme structure but empty package description field.
- Alphabetical index covering 205 Kuroco Smarty plugins for server-side processing
- Category references: API/data fetch, strings, arrays, forms/UI, auth/security, integrations, files, Vue templates
- Documents patterns like api_internal, api_mng, assign_api_credential, and OpenAI ai_completion / ai_embeddings
- Maps Firebase activity, token helpers, and array manipulation for template pipelines
- Japanese-first plugin names and descriptions aligned with official Kuroco server processing docs
Kuroco Server Processing by the numbers
- 36 all-time installs (skills.sh)
- Ranked #3,322 of 4,347 Backend & APIs skills by installs in the Skillselion catalog
- Security screen: HIGH risk (skills.sh audit)
- Data as of Jul 29, 2026 (Skillselion catalog sync)
npx skills add https://github.com/diverta/kuroco-skills --skill kuroco-server-processingAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 36 |
|---|---|
| repo stars | ★ 1 |
| Security audit | 2 / 3 scanners passed |
| Last updated | July 27, 2026 |
| Repository | diverta/kuroco-skills ↗ |
What it does
Implement Kuroco headless CMS server-side logic with the right Smarty plugins instead of guessing API and template APIs.
Who is it for?
Best when you're shipping marketing sites, member portals, or headless content apps on Kuroco with custom Smarty and API glue.
Skip if: Developers not on Kuroco, or pure static frontends with no server-side template processing.
When should I use this skill?
User works on Kuroco server-side Smarty processing, plugin selection, or category docs (API, auth, forms, integrations, Vue).
What you get
You get the correct plugin name, category reference, and usage context so the agent implements Kuroco server processing without inventing unsupported APIs.
- Correct Smarty plugin usage snippets
- Pointers to category reference markdown
- Integration patterns for internal and external APIs
By the numbers
- 205 Smarty plugins indexed
- 8 category reference files for plugin families
Files
Kuroco サーバーサイド処理
KurocoのSmartyテンプレートプラグインリファレンスおよびWebhook・バッチ処理パターン。
ドキュメント参照: /kuroco-docs スキルを使用してKuroco公式ドキュメントを検索・参照できます。
目次
Part 1: Smartyプラグインリファレンス
- よく使うプラグイン
- プラグイン種別
- カテゴリ別リファレンス
- Smarty構文リファレンス - 基本構文、制御構造、組み込み変数
Part 2: Webhook・バッチ処理パターン
---
Part 1: Smartyプラグインリファレンス
KurocoのSmartyテンプレートで使用可能な全プラグインの完全リファレンス。
よく使うプラグイン
変数・データ操作
| プラグイン | 説明 | 例 |
|---|---|---|
assign | 変数代入 | {assign var="name" value="値"} |
append | 配列追加 | {append var="arr" value="値"} |
json_decode | JSONパース | `{$json\ |
rcms_json_encode | JSONエンコード | `{$arr\ |
API・データ取得
| プラグイン | 説明 | 例 |
|---|---|---|
api_internal | 内部API呼び出し | {api_internal endpoint='/rcms-api/1/news' var='result'} |
assign_topics_list | 記事一覧取得 | {assign_topics_list var='list' topics_group_id=1} |
assign_topics_detail | 記事詳細取得 | {assign_topics_detail var='detail' topics_id=$id} |
assign_tag_list | タグ一覧取得 | {assign_tag_list var='tags'} |
→ 詳細: references/api-plugins.md
文字列処理
| プラグイン | 説明 | 例 |
|---|---|---|
escape | エスケープ | `{$html\ |
truncate | 文字列切り詰め | `{$text\ |
mb_truncate | マルチバイト対応 | `{$text\ |
date_format | 日付フォーマット | `{$date\ |
translate | 翻訳 | `{$key\ |
nl2br | 改行をBRに | `{$text\ |
replace | 文字列置換 | `{$text\ |
→ 詳細: references/string-plugins.md
フォーム・UI
| プラグイン | 説明 | 例 |
|---|---|---|
fileupload | ファイルアップロード | {fileupload name="file" ...} |
inquiry_input | フォーム入力 | {inquiry_input col="name" ...} |
pager | ページネーション | {pager ...} |
editActionBox | 編集ボタン | {editActionBox ...} |
html_options | selectオプション | {html_options options=$opts} |
→ 詳細: references/form-plugins.md
認証・権限
| プラグイン | 説明 | 例 |
|---|---|---|
rcms_auth | 権限制御ブロック | {rcms_auth target="read:news"}...{/rcms_auth} |
login | ログイン処理 | {login ...} |
logout | ログアウト処理 | {logout ...} |
→ 詳細: references/auth-plugins.md
外部サービス連携
| プラグイン | 説明 | 例 |
|---|---|---|
sendmail | メール送信 | {sendmail to=$email subject="件名" ...} |
slack_post_message | Slack通知 | {slack_post_message webhook_url=$url ...} |
ai_completion | AI呼び出し | {ai_completion prompt=$prompt var='result'} |
github_deploy | GitHubデプロイ | {github_deploy ...} |
→ 詳細: references/integration-plugins.md
ファイル操作
| プラグイン | 説明 | 例 |
|---|---|---|
write_file | ファイル書き込み | {write_file var="path" value="内容"} |
put_file | ストレージアップロード | {put_file path="/files/..." tmp_path=$tmp} |
read_file | ファイル読み込み | {read_file path="/files/..." var='content'} |
read_dir | ディレクトリ読み込み | {read_dir path="/files/..." file_var='file'}...{/read_dir} |
→ 詳細: references/file-plugins.md
Vue.js連携
| プラグイン | 説明 | 例 |
|---|---|---|
rcms_vue_component | Vueコンポーネント | {rcms_vue_component config="rcms-mng" name="..."} |
head_include | headに追加 | {head_include file="..."} |
bodyend | body終了前に追加 | {bodyend}...{/bodyend} |
→ 詳細: references/vue-plugins.md
プラグイン種別
関数プラグイン (Function)
出力を生成または処理を実行する関数。
{function_name param1="value1" param2="value2"}修飾子プラグイン (Modifier)
変数の値を変換・加工する。パイプ(|)で連結可能。
{$variable|modifier1|modifier2:param}ブロックプラグイン (Block)
開始タグと終了タグで囲まれた範囲を処理。
{block_name param="value"}
コンテンツ
{/block_name}カテゴリ別リファレンス
| カテゴリ | ファイル | 主なプラグイン |
|---|---|---|
| 構文リファレンス | syntax.md | 基本構文、制御構造、組み込み変数、ベストプラクティス |
| API・データ取得 | api-plugins.md | api_internal, assign_topics_list, assign_tag_list |
| 文字列処理 | string-plugins.md | escape, truncate, date_format, translate |
| 配列操作 | array-plugins.md | count, in_array, implode, explode, sort系 |
| フォーム・UI | form-plugins.md | fileupload, inquiry_input, pager, html_* |
| 認証・権限 | auth-plugins.md | rcms_auth, login, logout |
| 外部連携 | integration-plugins.md | sendmail, slack_*, ai_completion |
| ファイル操作 | file-plugins.md | write_file, put_file, read_file, read_dir |
| Vue.js連携 | vue-plugins.md | rcms_vue_component, head_include |
| 全プラグイン | all-plugins.md | 全206プラグイン一覧 |
使用例
コンテンツ一覧をAPIで取得して表示
{assign var="queries" value=$dataSet.emptyArray}
{append var="queries" index="cnt" value=10}
{append var="queries" index="filter" value="topics_flg = 1"}
{api_internal
endpoint='/rcms-api/1/news'
method='GET'
member_id=1
queries=$queries
var='result'
}
{foreach from=$result.list item="news"}
<h2>{$news.subject|escape}</h2>
<p>{$news.contents|truncate:200}</p>
<time>{$news.ymd|date_format:"%Y年%m月%d日"}</time>
{/foreach}
{pager data=$result.pageInfo}フォーム送信後にSlack通知
{sendmail
var=mail_result
to=$inquiry.email
subject="お問い合わせありがとうございます"
mail_template="inquiry_thanks"
}
{slack_post_message
webhook_url=$smarty.const.SLACK_WEBHOOK_URL
text="新規問い合わせ: {$inquiry.name}様 - {$inquiry.subject}"
}権限に応じた表示制御
{rcms_auth target="write:news"}
<a href="/management/news/edit/">編集</a>
{/rcms_auth}
{rcms_auth target="delete:news"}
<button class="delete-btn">削除</button>
{/rcms_auth}---
Part 2: Webhook・バッチ処理パターン
Kuroco HeadlessCMSでのWebhook、バッチ処理、外部連携に関するベストプラクティス。
Smarty構文について: バッチ処理・トリガーはSmartyテンプレートで記述します。構文やプラグインの詳細は上記 Part 1 を参照してください。
バッチ処理
概要
バッチ処理は一定時間ごとに自動実行される処理。
実行頻度の選択肢:
| 頻度 | 用途 |
|---|---|
| 15分毎 | 頻繁な同期が必要な場合 |
| 30分毎 | 準リアルタイム処理 |
| 1時間毎 | 定期的な集計・更新 |
| 毎日(指定時刻) | 日次レポート、バックアップ |
ユースケース
- 外部システムへのCSV生成・連携
- 外部システムからのデータ取り込み
- ログ集計・統計データ算出
- 定期的なメール配信
- GitHub Actions連携(デプロイトリガー)
バッチ処理の作成
管理画面: [オペレーション] → [バッチ処理] → [追加]
| 項目 | 説明 | 例 |
|---|---|---|
| タイトル | バッチの名前 | CSV出力バッチ |
| 識別子 | ユニークな識別子(英数字) | csv_export |
| 実行頻度 | 実行間隔 | 毎日 03:00 |
| 実行内容 | Smarty構文で記述 | 下記参照 |
内部API呼び出し
基本構文
{api_internal
endpoint='/rcms-api/1/news'
method='GET'
member_id=1
queries=$queries
var='response'
}コンテンツ一覧取得
{assign var="queries" value=$dataSet.emptyArray}
{append var="queries" index="cnt" value=0}
{append var="queries" index="filter" value="topics_flg = 1"}
{api_internal
endpoint='/rcms-api/1/news'
method='GET'
member_id=1
queries=$queries
var='news_list'
}
{foreach from=$news_list.list item="news"}
ID: {$news.topics_id}, タイトル: {$news.subject}
{/foreach}コンテンツ作成
{assign var="body" value=$dataSet.emptyArray}
{append var="body" index="subject" value="タイトル"}
{append var="body" index="contents" value="本文"}
{append var="body" index="topics_flg" value=1}
{api_internal
endpoint='/rcms-api/1/news/insert'
method='POST'
member_id=1
body=$body
var='result'
}外部API呼び出し
基本構文
{api_request
url='https://api.example.com/endpoint'
method='GET'
headers=$headers
body=$body
var='response'
}POSTリクエスト例
{assign var="headers" value=$dataSet.emptyArray}
{append var="headers" index="Content-Type" value="application/json"}
{append var="headers" index="Authorization" value="Bearer YOUR_API_KEY"}
{assign var="body" value=$dataSet.emptyArray}
{append var="body" index="message" value="Hello"}
{api_request
url='https://api.example.com/post'
method='POST'
headers=$headers
body=$body|@json_encode
var='response'
}トリガー処理
コンテンツ更新時のトリガー
管理画面: [コンテンツ定義] → [トリガー設定]
利用可能なイベント:
| イベント | タイミング |
|---|---|
| 作成時 | コンテンツ新規作成後 |
| 更新時 | コンテンツ更新後 |
| 削除時 | コンテンツ削除後 |
| 公開時 | 公開ステータス変更時 |
利用可能な変数:
{$topics.topics_id} {* コンテンツID *}
{$topics.subject} {* タイトル *}
{$topics.contents} {* 本文 *}
{$topics.ymd} {* 公開日 *}
{$topics.ext_col_01} {* 拡張項目 *}フォーム送信時のトリガー
管理画面: [フォーム] → [トリガー設定]
{$inquiry.inquiry_id} {* 回答ID *}
{$inquiry.name} {* 名前 *}
{$inquiry.email} {* メールアドレス *}
{$inquiry.message} {* メッセージ *}外部サービス連携
詳細な連携パターン: references/integrations.md を参照
Slack通知
{assign var="message" value=$dataSet.emptyArray}
{append var="message" index="text" value="通知メッセージ"}
{slack_send
webhook_url="https://hooks.slack.com/services/xxx/yyy/zzz"
body=$message|@json_encode
}メール通知
{send_mail
to="recipient@example.com"
subject="件名"
body="本文"
}GitHub Actions連携
{assign var="headers" value=$dataSet.emptyArray}
{append var="headers" index="Authorization" value="token YOUR_GITHUB_TOKEN"}
{append var="headers" index="Accept" value="application/vnd.github.v3+json"}
{assign var="body" value=$dataSet.emptyArray}
{append var="body" index="event_type" value="kuroco-update"}
{api_request
url='https://api.github.com/repos/owner/repo/dispatches'
method='POST'
headers=$headers
body=$body|@json_encode
var='response'
}ベストプラクティス
負荷を考慮した実行時間
- システム負荷の低い時間帯(深夜・早朝)に設定
- 大量データ処理は1日1回に制限
- ページネーションを使用して分割処理
エラーハンドリング
{api_internal
endpoint='/rcms-api/1/news'
method='GET'
member_id=1
var='response'
}
{if $response.errors}
{slack_send webhook_url="..." text="エラー: {$response.errors|@json_encode}"}
{log message="エラー: {$response.errors|@json_encode}"}
{else}
{log message="処理完了: {$response.pageInfo.totalCnt}件"}
{/if}タイムアウト対策
大量データは分割処理:
{assign var="page" value=1}
{while true}
{assign var="queries" value=$dataSet.emptyArray}
{append var="queries" index="pageID" value=$page}
{append var="queries" index="cnt" value=100}
{api_internal endpoint='/rcms-api/1/news' method='GET' member_id=1 queries=$queries var='response'}
{foreach from=$response.list item="item"}
{* 処理 *}
{/foreach}
{if $page >= $response.pageInfo.totalPageCnt}{break}{/if}
{assign var="page" value=$page+1}
{/while}---
関連スキル
/kuroco-api-content- API設計・認証パターン、コンテンツCRUD操作/kuroco-admin-api- 管理API(admin_api)の操作
関連ドキュメント
../kuroco-docs/docs/tutorials/how-to-use-batch.md- バッチ処理の使い方../kuroco-docs/docs/tutorials/auto-run-github-with-contents-update.md- GitHub Actions連携../kuroco-docs/docs/tutorials/send-slack-notification-after-a-form-has-been-submitted.md- Slack通知../kuroco-docs/docs/reference/trigger-variables.md- トリガー変数
全Smartyプラグイン一覧
Kurocoで使用可能な全205個のSmartyプラグインのアルファベット順索引です。
カテゴリ別リファレンス
| カテゴリ | ファイル |
|---|---|
| API・データ取得プラグイン | api-plugins.md |
| 文字列処理プラグイン | string-plugins.md |
| 配列操作プラグイン | array-plugins.md |
| フォーム・UIプラグイン | form-plugins.md |
| 認証・セキュリティプラグイン | auth-plugins.md |
| 外部サービス連携プラグイン | integration-plugins.md |
| ファイル操作プラグイン | file-plugins.md |
| Vue.js・テンプレート連携プラグイン | vue-plugins.md |
---
プラグイン一覧(アルファベット順)
A
| プラグイン | 説明 |
|---|---|
| activity | Firebase Firestoreデータベース操作を行います。 |
| add | 変数に数値を加算します。 |
| ai_completion | OpenAIを使用したAI補完(チャット)を行います。 |
| ai_embeddings | OpenAIを使用してテキストのAI埋め込み(Embeddings)を作成・保存... |
| api_internal | 内部API(同じKurocoサイト内)をリクエストします。 |
| api_method | エンドポイントを作成せずにAPIメソッドを直接実行します。 |
| api_mng | 管理APIを内部的にリクエストします。 |
| api_token | APIトークン(静的または動的)を取得します。 |
| array_key_exists | Checks if a key exists in an array. This... |
| assign | Assign a value to a template variable at... |
| assign_api_credential | API認証情報(署名、セッションID、JWT等)を生成します。 |
| assign_array | 配列をテンプレート変数に代入します。 |
| assign_array_diff | 2つの配列の差分を取得します。 |
| assign_array_get | 配列からキーで値を取得します。 |
| assign_array_intersect | 2つの配列の共通部分を取得します。 |
| assign_array_pick | 配列から特定のキーを抽出します。 |
| assign_array_set | 配列に値を設定します。 |
| assign_array_unset | 配列からキーを削除します。 |
| assign_comment_list | Retrieve a list of comments for a specif... |
| assign_date | Generate arrays of date values for use i... |
| assign_favorite_cnt | Get the total number of favorites (likes... |
| assign_group_nm | Retrieve the display name of a member gr... |
| assign_help_documents | ヘルプドキュメントを取得します。 |
| assign_json_ld | Generate JSON-LD structured data for SEO... |
| assign_login_log_list | ログインログ一覧を取得します。 |
| assign_manifest_json | Read a value from a webpack/build manife... |
| assign_my_favorite_cnt | Get the current user's favorite count fo... |
| assign_new_comment_list | Retrieve the most recent comments for a ... |
| assign_product_ext | Extract and format extension field data ... |
| assign_rcms_conf | RCMS設定値を取得します。 |
| assign_relation_tag_list | Retrieve tags associated with a specific... |
| assign_relation_topics_list | Retrieve topics that are related to a sp... |
| assign_session | セッションに値を代入します。 |
| assign_session_info | 現在のセッション情報を取得します。 |
| assign_tag_category_list | Retrieve the list of tag categories for ... |
| assign_tag_list | Retrieve tags belonging to a specific ta... |
| assign_topics_categories | Retrieve categories associated with a sp... |
| assign_topics_category_list | Retrieve categories for a topics group w... |
| assign_topics_ext | Extract and format extension field data ... |
B
| プラグイン | 説明 |
|---|---|
| backup | バックアップジョブを開始します。 |
| backup_delete | バックアップを削除します。 |
| block | Replace a block with the same name for a... |
| bodyend | Append content to the template's body en... |
| bodystart | Append content to the template's body st... |
| buttonbox | Decorate submit buttons in the admin/man... |
C
| プラグイン | 説明 |
|---|---|
| capitalize | Capitalize first letter of each word. |
| cat | Concatenate a value to a variable. |
| conv_bool | Converts a value to a boolean using the ... |
| count | Counts the number of elements in an arra... |
| count_characters | Count number of characters in text. |
| count_paragraphs | Count number of paragraphs in text. |
| count_sentences | Count number of sentences in text. |
| count_words | Count number of words in text. |
| counter | Print or assign a counter value, increme... |
| cycle | Cycle through a set of values on each ca... |
D
| プラグイン | 説明 |
|---|---|
| date | Generate and assign a formatted date str... |
| date_format | Format datestamps using PHP date() forma... |
| debug | Output debug console showing template va... |
| debug_print_var | Format variable contents for display in ... |
| default | Provide default value for empty variable... |
| detect_document_text | PDF/TIFFファイルからテキストを検出(OCR)します。 |
E
| プラグイン | 説明 |
|---|---|
| ec_combination_list | Add a product combination list for a spe... |
| ec_product_select_box | Display a product selection box for EC c... |
| editActionBox | Generate action buttons for content edit... |
| editTagsBox | Generate a tag selection and editing int... |
| empty | Checks whether a value is empty, with en... |
| escape | Escape string according to specified typ... |
| escape_special_chars | Escape special HTML characters while pre... |
| explode | Splits a string into an array using a de... |
F
| プラグイン | 説明 |
|---|---|
| fileupload | File upload component supporting both S3... |
| function | 静的コンテンツで定義されたSmarty関数を実行します。 |
G
| プラグイン | 説明 |
|---|---|
| gcloud_functions_token | Google Cloud Functionsトークンを取得します。 |
| gcloud_pubsub_publish | Google Cloud Pub/Subにメッセージを発行します。 |
| gcs_fileupload | File upload component for Google Cloud S... |
| generate_pdf | PDFを生成します。 |
| get_file | ファイルを取得します。 |
| get_pwd_lastchange | パスワード最終変更日時を取得します。 |
| github_deploy | GitHubデプロイを実行します。 |
| googleanalytics | Google Analyticsタグを出力します。 |
| group_select_box | Generate a member group selection interf... |
H
| プラグイン | 説明 |
|---|---|
| head_include | Queue a template file to be included in ... |
| headblock | Append content to the template's head se... |
| headstart | Append content to the template's head st... |
| html5_check | HTML5チェックを行います。 |
| html_checkboxes | Generate HTML checkbox group from array ... |
| html_image | Generate HTML <img> tag with automatic... |
| html_options | Generate HTML <option> elements for se... |
| html_radios | Generate HTML radio button group from ar... |
| html_select_date | Generate date selection dropdowns (year,... |
| html_select_time | Generate time selection dropdowns (hour,... |
| html_table | Generate HTML table from array of data. |
I
| プラグイン | 説明 |
|---|---|
| implode | Joins array elements into a string using... |
| in_array | Checks if a value exists in an array. PH... |
| include | テンプレートをインクルードします。 |
| indent | Indent lines of text. |
| inquiry_block | Insert a hidden MODE input into forms wi... |
| inquiry_input | Replace placeholder comments in content ... |
| inquiry_input_required | Conditionally display content based on w... |
| inquiry_options | Generate form input elements for inquiry... |
J
| プラグイン | 説明 |
|---|---|
| join | Joins array elements into a string using... |
| json_decode | Decodes a JSON string into a PHP value. |
L
| プラグイン | 説明 |
|---|---|
| lower | Convert string to lowercase. |
M
| プラグイン | 説明 |
|---|---|
| mailtemplate | メールテンプレートを取得します。 |
| make_pdf_thumb | PDFのサムネイルを作成します。 |
| make_timestamp | Convert various date/time formats to Uni... |
| math | Perform mathematical calculations in tem... |
| mb_truncate | Truncate string to specified length (mul... |
| mbtruncate | マルチバイト文字対応で文字列を切り詰めます。内部的に `rcms_mbtrunc... |
| mng_plugin_wrapper | Load and render admin management plugins... |
| msgpack_pack | データをMessagePack形式バイナリに変換します。 |
| msgpack_unpack | MessagePackエンコードされたデータをPHPの値に復元します。 |
N
| プラグイン | 説明 |
|---|---|
| nl2br | Convert newlines to HTML <br> tags. |
P
| プラグイン | 説明 |
|---|---|
| pager | Generate pagination navigation links for... |
| pg_dateformat | Format a PostgreSQL date. |
| pg_dateformat2 | Format a PostgreSQL date (alternative ve... |
| pg_timeformat | Format a PostgreSQL time. |
| property_exists | オブジェクトまたはクラスにプロパティが存在するかチェックします。 |
| purge_cdn_cache | CDNおよびイメージCDNのキャッシュをパージ(削除)します。 |
| put_file | ファイルをクラウドストレージまたはKurocoFilesにアップロードします。 |
| put_file_zip | ファイルをZip圧縮してアップロードする |
R
| プラグイン | 説明 |
|---|---|
| random_string | ランダム文字列を生成します。 |
| raw | Output without escaping. |
| rcms_arsort | Sort an array by values in descending or... |
| rcms_asort | Sort an array by values in ascending ord... |
| rcms_auth | Show or hide content based on user resou... |
| rcms_encrypt | データの暗号化および復号を行います。 |
| rcms_file_exists | Check if a file exists at the specified ... |
| rcms_file_mtime | Get the last modification time of a file... |
| rcms_file_size | Get the file size. |
| rcms_hash | ハッシュを生成します。 |
| rcms_in_array | Check if a value exists in an array. |
| rcms_include | Include a template file with RCMS resour... |
| rcms_json_encode | 値をUnicodeサポート付きでJSON形式にエンコードし、RCMSコンテンツ境... |
| rcms_krsort | Sort an array by key in reverse order. |
| rcms_ksort | Sort an array by key. |
| rcms_language_status | Display language data availability statu... |
| rcms_match | 正規表現マッチング(preg_match)を行います。 |
| rcms_match_all | 正規表現で全マッチを取得します(preg_match_all)。 |
| rcms_number_format | Format a number (extended version). |
| rcms_pathinfo | Get path information. |
| rcms_publicimg | Get the public/private/restricted status... |
| rcms_replace | Replace a string using regular expressio... |
| rcms_rsort | Sort an array in reverse order. |
| rcms_sort | Sort an array. |
| rcms_sort_by_key | Sort an array of associative arrays by a... |
| rcms_str_exists | Check if a string exists within another ... |
| rcms_strip_tags | Remove HTML tags from a string. |
| rcms_sub_area | Convert sub-area code to its name. |
| rcms_vue_component | Load and mount a Vue.js component within... |
| read_dir | KurocoFiles内のディレクトリを読み込み、ファイルリストを繰り返し処理し... |
| read_file | ファイルを1行ずつ読み込み、各行を繰り返し処理します。 |
| refresh_cs | メンバーカスタム検索(MemberCustomSearch)のセッション情報をリ... |
| regex_replace | Search and replace using regular express... |
| remove_dir | ディレクトリを削除します。 |
| remove_file | ファイルを削除します。 |
| rename_file | S3/GCS上のファイルを移動(リネーム)します。 |
| replace | Simple string search and replace. |
| replace_md_alt | Markdown画像構文のaltテキストを指定された説明に置換します。 |
| return | テンプレートのコンパイル時に 'return' 文を生成します。オプションで値を... |
S
| プラグイン | 説明 |
|---|---|
| save_file | 一時ファイルとしてコンテンツを保存します。 |
| secret | シークレット値を取得します。 |
| sendmail | メールを送信します。 |
| set_memory | PHPのメモリ制限を増加させます。 |
| site_sync | マルチサイト環境でサイト間の同期ジョブをキックします。 |
| slack_get_message | Slackから特定のメッセージを取得します。 |
| slack_post_message | Slackにメッセージを投稿します。 |
| slack_team_info | Slackのチーム情報を取得します。 |
| sleep | 指定されたミリ秒数だけ実行を一時停止します。 |
| sort_name | サイトの言語設定に基づいて姓名を適切な順序でフォーマットします。 |
| spacify | Add spaces (or custom string) between ea... |
| split | 区切り文字を使用して文字列を配列に分割します。正規表現とリテラル区切り文字の両方... |
| storage_url | クラウドストレージ上のファイルへの署名付きURLを取得します。 |
| string_format | Format string using sprintf. |
| strip | Replace all repeated whitespace with a s... |
| strip_tags | Remove HTML tags from text. |
| strtodate | タイムスタンプまたは日付文字列をフォーマットして日付を取得します。 |
| strtolower | Convert string to lowercase (with type c... |
| strtoupper | Convert string to uppercase (with type c... |
| substr | Return substring from input string (with... |
| subtract | 変数から数値を減算します。 |
| sync_counter | コンテンツのカウンター値を同期します。 |
| systempage | システムページ(404、401など)を表示するための例外を生成します。 |
T
| プラグイン | 説明 |
|---|---|
| textformat | Format text with wrapping, indentation, ... |
| to_form_options | 連想配列をフォームセレクト/オプション要素に適した形式に変換します。 |
| to_object | 配列をstdClassオブジェクトに変換します。 |
| topics_ext | Output extension field data from topics ... |
| topics_extensions | Retrieve and output multiple extension f... |
| topics_options | Generate form input elements for topics ... |
| translate | Translate a string. |
| translate_modules | Translate a module string. |
| translate_rec | Translate recursively through nested str... |
| trimwhitespace | Trim leading whitespace and blank lines ... |
| truncate | Truncate string to specified length (byt... |
| twitter_post_message | Twitter(X)にツイートを投稿します。 |
U
| プラグイン | 説明 |
|---|---|
| unzip | ZIPファイルを解凍してクラウドストレージにアップロードします。 |
| update_counter | コンテンツのカウンター項目を指定した値に更新します。 |
| upper | Convert string to uppercase. |
| usage_price_format | RCMS_Usageフォーマットシステムを使用して使用量/価格値を表示用にフォー... |
| uuid | UUIDを生成します。 |
V
| プラグイン | 説明 |
|---|---|
| var | Fetch template content from a global PHP... |
W
| プラグイン | 説明 |
|---|---|
| wordwrap | Wrap text to specified line length. |
| write_file | ファイルにデータを書き込みます(一時ファイルまたは指定パス)。 |
| wysiwyg | Generate WYSIWYG editor HTML for rich te... |
X
| プラグイン | 説明 |
|---|---|
| xmltojson | XMLをJSONに変換します。 |
Z
| プラグイン | 説明 |
|---|---|
| zip | クラウドファイルをZIP圧縮してクラウドストレージにアップロードします。 |
API・データ取得プラグイン
目次
- api_internal - 内部API(同じKurocoサイト内)をリクエストします。
- api_method - エンドポイントを作成せずにAPIメソッドを直接実行します。
- api_mng - 管理APIを内部的にリクエストします。
- api_token - APIトークン(静的または動的)を取得します。
- assign_topics_ext - Extract and format extension f...
- assign_topics_categories - Retrieve categories associated...
- assign_topics_category_list - Retrieve categories for a topi...
- assign_tag_list - Retrieve tags belonging to a s...
- assign_tag_category_list - Retrieve the list of tag categ...
- assign_comment_list - Retrieve a list of comments fo...
- assign_new_comment_list - Retrieve the most recent comme...
- assign_favorite_cnt - Get the total number of favori...
- assign_my_favorite_cnt - Get the current user's favorit...
- assign_relation_topics_list - Retrieve topics that are relat...
- assign_relation_tag_list - Retrieve tags associated with ...
- assign_product_ext - Extract and format extension f...
- assign_json_ld - Generate JSON-LD structured da...
- assign_manifest_json - Read a value from a webpack/bu...
- assign_group_nm - Retrieve the display name of a...
- assign_rcms_conf - RCMS設定値を取得します。
- assign_help_documents - ヘルプドキュメントを取得します。
- assign_date - Generate arrays of date values...
- assign_api_credential - API認証情報(署名、セッションID、JWT等)を生成します...
---
api_internal
内部API(同じKurocoサイト内)をリクエストします。
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| endpoint | String | Required | - | エンドポイントパス(形式: /rcms-api/<api_id>/...) |
| method | String | Optional | 'GET' | HTTPメソッド(GET/POST) |
| query | String | Optional | - | クエリ文字列(例: ex=1&ex2=2) |
| queries | Array | Optional | - | クエリ配列 |
| headers | Array | Optional | [] | リクエストヘッダー配列 |
| cache_time | Integer | Optional | 0 | キャッシュ時間(分)。GETリクエストかつmember_idなしの場合のみ有効 |
| direct | Boolean | Optional | false | ネットワーク(curl)を介さず直接実行。GETメソッドのみ対応、member_id指定不可 |
| var | String | Optional | - | レスポンスを格納する変数名 |
| status_var | String | Optional | - | 成功ステータス変数(0:失敗、1:成功) |
| http_code_var | String | Optional | - | HTTPステータスコードを格納する変数名 |
| member_id | Integer | Optional | - | 指定したメンバーIDとしてAPIを実行。動的トークン認証のAPIでのみ使用可能 |
| use_current_session | Boolean | Optional | false | 現在のセッションを引き継いでAPIリクエストを実行 |
Return Value
指定した変数にAPIレスポンス(配列)が代入されます。status_varには成功時は1、失敗時は0が代入されます。
Usage Example
{* 基本的な使用例 *}
{api_internal endpoint='/rcms-api/1/sample' method='GET' query='ex=1&ex2=2' cache_time=20 var='response' status_var='status'}
{* 特定のメンバーとして実行 *}
{api_internal endpoint='/rcms-api/1/member/profile' method='GET' member_id=123 var='profile' status_var='status'}
{* 現在のセッションを使用 *}
{api_internal endpoint='/rcms-api/1/mypage' method='GET' use_current_session=true var='data' status_var='status'}
{* ダイレクトモード(GETのみ) *}
{api_internal endpoint='/rcms-api/1/public/list' method='GET' direct=true var='list' status_var='status'}Notes
- 同じKurocoサイト内のAPIを呼び出す際に使用します
- エンドポイントは
/rcms-api/<api_id>/...の形式である必要があります - 同じエンドポイントへの再帰呼び出しは自動的に防止されます
directオプションを使用するとネットワークを介さず直接実行できます(GETのみ、member_id指定不可)member_idで特定のメンバーとして実行する場合、APIは動的トークン認証(Dynamic Token)である必要があります- キャッシュはGETリクエストかつmember_idなしの場合のみ有効です
- バリデーションモード(
_rcms_validate)の場合、実際のAPIリクエストは実行されません
---
api_method
エンドポイントを作成せずにAPIメソッドを直接実行します。
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| var | String | Optional | - | 結果を代入する変数名 |
| model | String | Required | - | APIモデル名(例: Topics, Member) |
| method | String | Required | - | モデルメソッド名(例: list, details) |
| version | Integer | Optional | 1 | モデルバージョン |
| request_params | Array | Optional | [] | リクエストパラメータ(クエリパラメータ相当) |
| method_params | Array | Optional | [] | メソッドパラメータ(URIパラメータ相当) |
Return Value
var パラメータで指定した変数にAPIメソッドの実行結果が代入されます。モデルやメソッドが見つからない場合は errors キーにエラーメッセージが含まれます。
Usage Example
{* トピックス一覧を取得 *}
{api_method var="output" model="Topics" method="list" request_params=$req_params}
{* トピックス詳細を取得 *}
{api_method var="detail" model="Topics" method="details" method_params=['topics_id' => 123]}
{* メンバー情報を取得 *}
{api_method var="member" model="Member" method="details" method_params=['member_id' => 456]}
{* バージョンを指定 *}
{api_method var="output" model="Topics" method="list" version=2 request_params=$params}
{* 言語を指定してリクエスト *}
{assign_array var="req" keys="lang" values="en"}
{api_method var="output" model="Topics" method="list" request_params=$req}Notes
modelとmethodパラメータは必須です- APIエンドポイントを作成せずに直接メソッドを呼び出せます
request_paramsにlangパラメータを含めることで言語を指定できます- 同一スレッド内で実行されるため、HTTPリクエストのオーバーヘッドがありません
- バリデーションモード(
_rcms_validate)の場合、空配列が返されます
---
api_mng
管理APIを内部的にリクエストします。
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| endpoint | String | Required | - | エンドポイントパス(形式: /management/<module>/...) |
| method | String | Optional | 'GET' | HTTPメソッド(GET/POST) |
| query | String | Optional | - | クエリ文字列 |
| queries | Array | Optional | [] | クエリ配列 |
| headers | Array | Optional | [] | リクエストヘッダー |
| files | Array | Optional | [] | アップロードファイル |
| var | String | Optional | - | レスポンスを格納する変数名 |
| status_var | String | Optional | - | 成功ステータス変数(0:失敗、1:成功) |
| member_id | Integer | Optional | - | 指定したメンバーIDとして実行 |
| use_current_session | Boolean | Optional | false | 現在のセッションを引き継いで実行 |
Return Value
指定した変数に管理APIのレスポンスが代入されます。status_varには成功時は1、失敗時は0が代入されます。
Usage Example
{* GETリクエスト *}
{api_mng endpoint='/management/topics/topics_list/' method='GET' query='topics_group_id=1' var='response' status_var='status'}
{* POSTリクエスト *}
{api_mng endpoint='/management/member/member_edit/' method='POST' queries=$post_data var='response' status_var='status'}
{* ファイルアップロード *}
{api_mng endpoint='/management/topics/topics_edit/' method='POST' queries=$data files=$upload_files var='response' status_var='status'}
{* メンバーダウンロード(特殊処理) *}
{api_mng endpoint='/management/member/member_download_all/' method='GET' var='csv_data' status_var='status'}Notes
- 管理画面用のAPIを内部から呼び出す際に使用します
- エンドポイントは
/management/<module>/<action>/の形式(5つのパス要素)である必要があります member_idで特定のメンバーとして実行できます- リクエストには自動的に
Accept: application/jsonヘッダーが追加されます - 認証情報(API credentials)は自動的に追加されます
- タイムアウトは20秒に設定されています
- バリデーションモード(
_rcms_validate)の場合、実際のリクエストは実行されません
---
api_token
APIトークン(静的または動的)を取得します。
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| var | String | Required | - | トークンを代入する変数名 |
| type | String | Required | - | トークンタイプ: static または dynamic |
| api_id | Integer | Required | - | API ID |
| expires | Integer | Optional | - | 有効期限(秒)。dynamicトークンで使用 |
| memo | String | Optional | 'Generated by Smarty api_token plugin' | メモ(staticトークンで使用) |
Return Value
var パラメータで指定した変数にAPIトークン文字列が代入されます。パラメータが不正な場合は null が代入されます。
Usage Example
{* 静的トークンを取得 *}
{api_token var="static_token" type="static" api_id=1}
{* 動的トークンを取得(有効期限1時間) *}
{api_token var="dynamic_token" type="dynamic" api_id=1 expires=3600}
{* メモ付きの静的トークンを取得 *}
{api_token var="token" type="static" api_id=2 memo="Batch process token"}Notes
var,type,api_idパラメータは必須ですtypeはstaticまたはdynamicのみ有効です- 不正なパラメータの場合、Smartyエラーがトリガーされます
staticトークンは永続的に有効ですdynamicトークンはexpiresで指定した秒数後に無効になります- バリデーションモード(
_rcms_validate)の場合、nullが代入されます
---
assign_topics_ext
Extract and format extension field data from topics content.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| var | String | Required | - | Variable name to store the result |
| id | String/Integer | Required | - | Extension field ID (e.g., '01', '02', '10') |
| ext_type | String | Required | 'value' | Type of data to extract (value, url, url_L, url_S, group, title, array, table, data, etc.) |
| ext_columns | Array | Conditional | - | Extension columns array from topics data |
| topics_id | Integer | Conditional | - | Topics ID (alternative to ext_columns) |
| row_value | Object | Optional | - | Full topics DB record object |
| ext_data | Object | Optional | - | Direct extension data to process |
| separator | String | Optional | '/' | Separator for multiple selection values |
| default | String | Optional | '' | Default value when field is empty |
| chk_open_flg | Boolean | Optional | true | Check publication status |
| parent_key | Integer | Optional | - | Parent key for hierarchical CSV master data |
| Boolean | Optional | false | If true, also prints the output | |
| return_flg | Boolean | Optional | false | If true, assign and return value |
| lang | String | Optional | Current lang | Language code |
| height | Integer | Optional | 480 | Video player height |
| width | Integer | Optional | 360 | Video player width |
Return Value
Extracted and formatted extension data assigned to the specified variable.
Usage Example
{assign_topics_ext ext_columns=$topics.ext_columns id='01' ext_type='url' var='main_image'}
{if $main_image}
<img src="{$main_image}" alt="{$topics.subject}">
{/if}
{assign_topics_ext ext_columns=$topics.ext_columns id='02' ext_type='value' default='N/A' var='author'}
<p>Author: {$author}</p>Notes
- The id parameter corresponds to ext_col_XX fields
- Using ext_columns is more efficient than topics_id
- Multi-select values are joined with the separator
---
assign_topics_categories
Retrieve categories associated with a specific topics group.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| var | String | Required | - | Variable name to store the result array |
| group_id | Integer | Required | - | Topics group ID |
| tree_flg | Boolean | Optional | false | Return hierarchical parent-child structure |
Return Value
Array of category objects assigned to the specified variable.
Usage Example
{assign_topics_categories group_id=1 var='categories'}
<select name="category_id">
<option value="">Select Category</option>
{foreach $categories as $cat}
<option value="{$cat.topics_category_id}">{$cat.topics_category_nm}</option>
{/foreach}
</select>
{assign_topics_categories group_id=1 tree_flg=true var='category_tree'}Notes
- Returns false if database connection is unavailable
- Only returns published categories (open_flg = 1)
- Categories are sorted by list_order field
---
assign_topics_category_list
Retrieve categories for a topics group with multi-language support.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| var | String | Required | - | Variable name to store the result array |
| topics_group_id | Integer | Required | - | Topics group ID |
| lang | String | Optional | Current lang | Language code for multi-language content |
Return Value
Array of category objects assigned to the specified variable.
Usage Example
{assign_topics_category_list topics_group_id=1 var='categories'}
<nav class="category-nav">
{foreach $categories as $cat}
<a href="/topics/category/{$cat.topics_category_id}/">{$cat.topics_category_nm}</a>
{/foreach}
</nav>
{assign_topics_category_list topics_group_id=1 lang='en' var='en_categories'}Notes
- Returns false if database connection is unavailable
- Only returns published categories (open_flg = 1)
- Supports multi-language when USE_MULTILANG is enabled
---
assign_tag_list
Retrieve tags belonging to a specific tag category.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| var | String | Required | - | Variable name to store the result array |
| category_id | Integer/String | Required | - | Tag category ID to filter by |
| order | String | Optional | 'list_order:asc' | Sort order in 'field:direction' format |
Return Value
Array of tag objects assigned to the specified variable.
Usage Example
{assign_tag_list category_id=2 var='genre_tags'}
<div class="tag-cloud">
{foreach $genre_tags as $tag}
<a href="/tag/{$tag.tag_id}/" class="tag">
{$tag.tag_nm}
<span class="count">({$tag.open_contents_cnt})</span>
</a>
{/foreach}
</div>
{assign_tag_list category_id=2 order='open_contents_cnt:desc' var='popular_tags'}Notes
- Only returns published tags (open_flg = 1)
- The open_contents_cnt is useful for tag cloud weighting
- Uses Tag::getTagList() internally
---
assign_tag_category_list
Retrieve the list of tag categories for organizing and filtering tags.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| var | String | Required | - | Variable name to store the result array |
| lang | String | Optional | Current lang | Language code for multi-language support |
| tree_flg | Boolean | Optional | false | Return hierarchical parent-child structure |
Return Value
Array of tag category objects assigned to the specified variable.
Usage Example
{assign_tag_category_list var='categories'}
<select name="tag_category">
<option value="">All Categories</option>
{foreach $categories as $cat}
<option value="{$cat.tag_category_id}">{$cat.tag_category_nm}</option>
{/foreach}
</select>
{assign_tag_category_list tree_flg=true var='category_tree'}Notes
- Returns false if database connection is unavailable
- Only returns published categories (open_flg = 1)
- Categories are sorted by list_order field
---
assign_comment_list
Retrieve a list of comments for a specified module and module ID.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| var | String | Required | - | Variable name to store the result array |
| module_type | String | Required | - | Module type (e.g., "topics", "member") |
| module_id | Integer | Required | - | ID of the content item to get comments for |
| lang | String | Optional | Current lang | Language code for multi-language support |
| cnt | Integer | Optional | - | Maximum number of comments to retrieve |
Return Value
Array of comment objects assigned to the specified variable.
Usage Example
{* Get comments for a topic *}
{assign_comment_list module_id=$topics.topics_id module_type='topics' cnt=10 var='comment_list'}
{if $comment_list}
<h3>Comments ({$comment_list|@count})</h3>
{foreach $comment_list as $comment}
<div class="comment">
<p>{$comment.comment|escape|nl2br}</p>
<small>{$comment.insert_date}</small>
</div>
{/foreach}
{/if}Notes
- Returns false if database connection is unavailable
- Returns early if system error (PAGE_NOTICE_KEY == "SYS_ERR")
- Comments are retrieved in chronological order by default
- Uses the Comment::getList() method internally
- Supports multi-language content via the lang parameter
---
assign_new_comment_list
Retrieve the most recent comments for a specific content item.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| module_id | Integer | Required | - | ID of the content item |
| module_type | String | Optional | 'topics' | Module type (e.g., 'topics') |
| var | String | Optional | 'new_comment_list' | Variable name to store results |
| cnt | Integer | Optional | 5 | Maximum number of comments to retrieve |
| new_order_flg | Boolean | Optional | false | If true, newest first; if false, oldest first |
Return Value
Array of comment objects assigned to the specified variable.
Usage Example
{assign_new_comment_list module_id=$topics.topics_id module_type='topics' cnt=5 var='comments'}
{foreach $comments as $comment}
<div class="comment">
<strong>{$comment.name1}</strong>
<p>{$comment.comment|escape|nl2br}</p>
<time>{$comment.insert_date|pg_dateformat:'Y/m/d H:i'}</time>
</div>
{/foreach}Notes
- Returns false if database connection is unavailable
- Different from assign_comment_list which supports pagination
- Uses Comment::getCommentNewList() internally
---
assign_favorite_cnt
Get the total number of favorites (likes) for a specific content item across all users.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| var | String | Required | - | Variable name to store the count |
| module_id | Integer | Required | - | ID of the content item |
| module_type | String | Optional | "topics" | Module type (e.g., "topics", "comment") |
| action_type | Integer | Optional | 0 | Action type (0 = like/favorite) |
| print_flg | Boolean/Integer | Optional | false | If true, output the count directly |
Return Value
Integer count of total favorites assigned to the specified variable.
Usage Example
{* Get favorite count for a topic *}
{assign_favorite_cnt module_type='topics' module_id=$topics.topics_id var='favorite_cnt'}
<span class="likes">{$favorite_cnt} likes</span>
{* Display count directly *}
{assign_favorite_cnt module_type='topics' module_id=123 var='cnt' print_flg=1}
{* Count for a specific action type *}
{assign_favorite_cnt module_type='topics' module_id=$id action_type=1 var='bookmark_cnt'}Notes
- Returns false if database connection is unavailable
- Returns early if system error (PAGE_NOTICE_KEY == "SYS_ERR")
- Counts ALL users' favorites for the item (site-wide total)
- For current user's favorite count, use assign_my_favorite_cnt instead
- The action_type parameter allows different types of engagement tracking
- Uses Favorite::favoriteCount() internally
---
assign_my_favorite_cnt
Get the current user's favorite count for their favorites list.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| var | String | Required | - | Variable name to store the count |
| module_type | String | Optional | 'topics' | Module type to count favorites for |
| module_id | Integer | Optional | - | Specific module ID (omit for all items) |
| action_type | Integer | Optional | 0 | Action type (0 = like/favorite) |
| topics_group_id | Integer/Array | Optional | - | Filter by topics group ID(s) |
| cookie_flg | Boolean | Optional | false | Include cookie-based favorites for guests |
| print_flg | Boolean | Optional | false | Output the count directly |
Return Value
Integer count of the current user's favorites assigned to the specified variable.
Usage Example
{assign_my_favorite_cnt module_type='topics' var='my_favorites'}
<p>You have {$my_favorites} favorite articles</p>
{assign_my_favorite_cnt module_type='topics' module_id=$topics.topics_id var='is_fav'}
{if $is_fav > 0}
<span class="favorited">Favorited</span>
{/if}
{assign_my_favorite_cnt module_type='topics' topics_group_id=5 var='news_favorites'}Notes
- Returns 0 if user has no favorites matching criteria
- When module_id is omitted, counts all user's favorites of that type
- Cookie-based favorites are useful for guest users
---
assign_relation_topics_list
Retrieve topics that are related to a specific topic based on configured relationships.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| var | String | Required | - | Variable name to store the result array |
| topics_id | Integer | Conditional | - | Source topics ID (required if relation_list not provided) |
| cnt | Integer | Required | - | Maximum number of related topics to return |
| relation_list | Array | Optional | - | Pre-defined list of related topic IDs |
| target_group_id | Integer/Array | Optional | - | Filter by topics group ID(s) |
| lang | String | Optional | Current lang | Language code for multi-language content |
| chk_open_flg | Boolean | Optional | true | Only return published topics |
| no_ext_column_flg | Boolean | Optional | false | Exclude extension columns (for performance) |
| shuffle_flg | Boolean | Optional | false | Randomize the order of results |
Return Value
Array of related topics objects assigned to the specified variable.
Usage Example
{assign_relation_topics_list topics_id=$topics.topics_id cnt=5 var='related'}
{if $related}
<h3>Related Articles</h3>
<ul>
{foreach $related as $rel}
<li><a href="/topics/{$rel.topics_id}/">{$rel.subject}</a></li>
{/foreach}
</ul>
{/if}Notes
- Returns false if database connection is unavailable
- Relations are configured in the topics management admin
- Set no_ext_column_flg=true when extension data is not needed for performance
---
assign_relation_tag_list
Retrieve tags associated with a specific content item.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| var | String | Required | - | Variable name to store the result array |
| module | String | Required | - | Module name (e.g., 'topics', 'member') |
| module_id | Integer | Required | - | ID of the content item |
| tag_category_id | Integer | Optional | - | Filter by specific tag category ID |
| tag_relation_list | Array | Optional | - | Pre-fetched tag relation data array |
Return Value
Array of tag objects assigned to the specified variable.
Usage Example
{assign_relation_tag_list module="topics" module_id=$topics.topics_id var="tags"}
{if $tags}
<div class="tags">
{foreach $tags as $tag}
<a href="/tag/{$tag.tag_id}/" class="tag">{$tag.tag_nm}</a>
{/foreach}
</div>
{/if}Notes
- Returns false if database connection is unavailable
- Only returns published tags (open_flg = 1) by default
- Uses Tag::getTagRelation() internally
---
assign_product_ext
Extract and format extension field data from EC (e-commerce) products.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| var | String | Required | - | Variable name to store the result |
| id | String/Integer | Required | - | Extension field ID (e.g., '01', '02') |
| ext_type | String | Required | 'value' | Type of data to extract (value, url, url_L, url_S, group, title, array, table, data, etc.) |
| ext_columns | Array | Conditional | - | Extension columns array from product data |
| product_id | Integer | Conditional | - | Product ID (alternative to ext_columns) |
| row_value | Object | Optional | - | Full product DB record object |
| ext_data | Object | Optional | - | Direct extension data to process |
| separator | String | Optional | '/' | Separator for multiple selection values |
| parent_key | Integer | Optional | - | Parent key for hierarchical CSV master data |
| Boolean | Optional | false | If true, also prints the output | |
| return_flg | Boolean | Optional | false | If true, assign and return value |
| lang | String | Optional | Current lang | Language code |
| height | Integer | Optional | 480 | Video player height |
| width | Integer | Optional | 360 | Video player width |
Return Value
Extracted and formatted extension data assigned to the specified variable.
Usage Example
{assign_product_ext ext_columns=$product.ext_columns id='02' ext_type='url' var='image_url'}
<img src="{$image_url}" alt="{$product.product_nm}">
{assign_product_ext ext_columns=$product.ext_columns id='05' ext_type='value' separator=', ' var='colors'}
<p>Available colors: {$colors}</p>Notes
- Functions identically to assign_topics_ext but for product data
- The id parameter corresponds to ext_col_XX fields
- Using ext_columns parameter is more efficient than product_id
---
assign_json_ld
Generate JSON-LD structured data for SEO and rich search results.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| type | String | Required | - | Schema.org type (BreadcrumbList, WebSite, LocalBusiness, etc.) |
| var | String | Optional | - | Variable name to assign the result |
| Boolean | Optional | false | Output the JSON-LD directly | |
| return_flg | Boolean | Optional | false | Return the value instead of assigning |
| footpath | Array | Optional | - | Breadcrumb array for BreadcrumbList type |
| data | Array | Optional | - | Custom data array for the schema |
Return Value
JSON-LD formatted string conforming to schema.org specifications.
Usage Example
{* Breadcrumb structured data *}
<script type="application/ld+json">
{assign_json_ld type="BreadcrumbList" footpath=$footpath print=1}
</script>
{* Website schema (auto-populated from site settings) *}
<script type="application/ld+json">
{assign_json_ld type="WebSite" print=1}
</script>
{* Local business with custom data *}
<script type="application/ld+json">
{assign_json_ld type="LocalBusiness" data=$LocalBusinessData print=1}
</script>Notes
- Always wrap output in <script type="application/ld+json"> tags
- Supported types: Article, NewsArticle, Book, Course, Event, LocalBusiness, Product, etc.
- The WebSite type auto-populates from site configuration
- Improves SEO with rich snippets in search results
---
assign_manifest_json
Read a value from a webpack/build manifest JSON file by key.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| manifest | String | Required | - | URL or path to the manifest.json file |
| key | String | Required | - | Key to retrieve from the manifest |
| var | String | Optional | - | Variable name to assign the value |
| Boolean | Optional | false | Output the value directly |
Return Value
The value associated with the specified key in the manifest file.
Usage Example
{assign_manifest_json manifest="{$smarty.const.ORIGINAL_JS_URL}/rcms-vue/manifest.json" key="rcms-vue.js" var="rcms_vue_js"}
<script src="{$rcms_vue_js}"></script>
{assign_manifest_json manifest="/files/assets/manifest.json" key="main.css" var="main_css"}
<link rel="stylesheet" href="{$main_css}">Notes
- Manifest file must be accessible via the provided URL/path
- Returns empty string if key doesn't exist in manifest
- Commonly used with webpack's WebpackManifestPlugin
- Essential for long-term caching with content-hashed filenames
---
assign_group_nm
Retrieve the display name of a member group by its ID.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| group_id | Integer | Conditional | - | Group ID to look up (either group_id or id required) |
| id | Integer | Conditional | - | Alternative parameter name for group_id |
| var | String | Required | - | Variable name to store the group name |
| lang | String | Optional | Current lang | Language code for multi-language support |
| print_flg | Boolean | Optional | false | If true, output the name directly |
Return Value
Group name string assigned to the specified variable.
Usage Example
{assign_group_nm group_id=100 var='group_name'}
<p>Group: {$group_name}</p>
{assign_group_nm id=$member.group_id var='member_group'}
{foreach $members as $member}
{assign_group_nm id=$member.group_id var='grp_nm'}
<tr>
<td>{$member.name1}</td>
<td>{$grp_nm}</td>
</tr>
{/foreach}Notes
- Returns false if database connection is unavailable
- The id parameter is an alias for group_id (either works)
- Supports multi-language group names when USE_MULTILANG is enabled
- Uses Group::getNameList() internally
---
assign_rcms_conf
RCMS設定値を取得します。
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| var | String | Required | - | 結果を代入する変数名 |
| key | String | Required | - | 設定キー |
Return Value
varパラメータで指定した変数に設定値が代入されます。
Usage Example
{assign_rcms_conf var="config_value" key="site_name"}Notes
- RCMSの設定値を取得します
---
assign_help_documents
ヘルプドキュメントを取得します。
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| var | String | Required | - | 結果を代入する変数名 |
Return Value
varパラメータで指定した変数にヘルプドキュメントが代入されます。
Usage Example
{assign_help_documents var="help_docs"}Notes
- システムのヘルプドキュメントを取得します
---
assign_date
Generate arrays of date values for use in date selection dropdowns.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| var | String | Required | - | Variable name to store the result array |
| type | String | Required | - | Date part type: "year", "month", or "day" |
| from | Integer/String | Optional | 1970 | Starting year (only for type="year") |
| to | Integer/String | Optional | Current year | Ending year (only for type="year") |
| initial | String | Optional | - | Placeholder value to prepend to the array |
| reverse_flg | Boolean | Optional | false | Reverse the array order (descending) |
Return Value
Associative array assigned to the specified variable.
Usage Example
{* Year dropdown from 2000 to 2025 with placeholder *}
{assign_date var=arr_year type='year' from='2000' to='2025' initial='---'}
<select name="year">
{html_options options=$arr_year selected=$selected_year}
</select>
{* Month dropdown with placeholder *}
{assign_date var=arr_month type='month' initial='Select Month'}
{* Day dropdown *}
{assign_date var=arr_day type='day'}
{* Years in descending order (newest first) *}
{assign_date var=arr_year type='year' from='1950' to='2025' reverse_flg=true}Notes
- Month and day values are zero-padded (01-12, 01-31)
- Year values are not padded
- The initial value uses empty string as key
- Useful for building date picker forms with separate dropdowns
- The to parameter defaults to the current year from date('Y')
- Combine with Smarty's {html_options} for easy dropdown generation
---
assign_api_credential
API認証情報(署名、セッションID、JWT等)を生成します。
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| var | String | Required | - | 結果を代入する変数名 |
| api_key | String | Conditional | - | APIキー(member_id未指定時は必須) |
| dg_key | String | Optional | - | DG_CODEを生成するためのキー |
| dg_id | String | Optional | - | DG_CODEを生成するためのID |
| member_id | Integer | Optional | - | 指定したメンバーIDの認証情報を生成 |
| expire | Integer | Optional | - | トークンの有効期限(秒) |
| jwt_data | Array | Optional | [] | JWTに含める追加データ |
Return Value
var パラメータで指定した変数に認証情報の連想配列が代入されます。member_id指定時は session_id, X-RCMS-API-ACCESS-TOKEN, jwt を含み、api_key指定時は signature, DG_CODE, sid, jwt を含みます。
Usage Example
{* APIキーを使用して認証情報を生成 *}
{assign_api_credential api_key=$api_key dg_key="topics_edit_api" dg_id="0" var=credentials}
{* 特定メンバーの認証情報を生成 *}
{assign_api_credential member_id=123 expire=300 var=credentials}
{* JWTに追加データを含める *}
{assign_api_credential member_id=123 jwt_data=$custom_data var=credentials}Notes
- ログインが必要です(member_id指定時を除く)
member_idを指定した場合は、そのメンバーの認証情報が生成されますapi_keyを指定した場合は、現在のログインユーザーの認証情報が生成されます- 生成されたJWTには
member_id,credentials,dataが含まれます - データベース接続がない場合やシステムエラー時は
falseを返します
---
配列操作プラグイン
目次
- count - Counts the number of elements ...
- in_array - Checks if a value exists in an...
- rcms_in_array - Check if a value exists in an ...
- array_key_exists - Checks if a key exists in an a...
- implode - Joins array elements into a st...
- join - Joins array elements into a st...
- explode - Splits a string into an array ...
- split - 区切り文字を使用して文字列を配列に分割します。正規表現とリテ...
- assign_array - 配列をテンプレート変数に代入します。
- assign_array_get - 配列からキーで値を取得します。
- assign_array_set - 配列に値を設定します。
- assign_array_unset - 配列からキーを削除します。
- assign_array_diff - 2つの配列の差分を取得します。
- assign_array_intersect - 2つの配列の共通部分を取得します。
- assign_array_pick - 配列から特定のキーを抽出します。
- rcms_sort - Sort an array.
- rcms_rsort - Sort an array in reverse order...
- rcms_asort - Sort an array by values in asc...
- rcms_arsort - Sort an array by values in des...
- rcms_ksort - Sort an array by key.
- rcms_krsort - Sort an array by key in revers...
- rcms_sort_by_key - Sort an array of associative a...
- json_decode - Decodes a JSON string into a P...
- rcms_json_encode - 値をUnicodeサポート付きでJSON形式にエンコードし、...
- to_object - 配列をstdClassオブジェクトに変換します。
- to_form_options - 連想配列をフォームセレクト/オプション要素に適した形式に変換...
- property_exists - オブジェクトまたはクラスにプロパティが存在するかチェックしま...
- empty - Checks whether a value is empt...
- conv_bool - Converts a value to a boolean ...
---
count
Counts the number of elements in an array. This is a PHP7-compatible Smarty count modifier.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| (modifier input) | Array | Required | - | The array to count |
Return Value
Returns an integer representing the number of elements in the array. Returns 0 if the input is not an array.
Usage Example
{$array|count}Notes
- Works with both indexed and associative arrays
- Returns
0for empty arrays - Unlike PHP's native
count(), this modifier returns0for non-array values instead of1 - PHP7-compatible: handles type checking before calling the native
count()function
---
in_array
Checks if a value exists in an array. PHP7-compatible with safe type handling.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| (modifier input) | any | Required | - | The value to search for (needle) |
| haystack | Array | Required | - | The array to search in |
| strict | Boolean | Optional | false | If true, uses strict type comparison (===) |
Return Value
Returns true if the value is found in the array, false otherwise. Returns false if the haystack is not an array.
Usage Example
{* Basic usage *}
{if $value|in_array:$array}Value exists{/if}
{* With strict type comparison *}
{if $value|in_array:$array:true}Value exists (strict){/if}
{* Safe even if $array might not be an array *}
{if "apple"|in_array:$fruits}Apple is in the list{/if}Notes
- Safe type handling: Returns
falseif the haystack is not an array (instead of throwing an error) - Performs a loose comparison by default (like PHP's
in_array()) - Set the third parameter to
truefor strict type comparison - PHP7-compatible: validates the haystack is an array before calling native
in_array()
---
rcms_in_array
Check if a value exists in an array.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| (input) | Mixed | Required | - | Value to search for |
| array | Array | Required | - | Array to search in |
Return Value
Boolean indicating whether the value exists in the array.
Usage Example
{if $value|rcms_in_array:$array}Exists{/if}Notes
- Equivalent to PHP's in_array() function
- Performs a loose comparison by default
---
array_key_exists
Checks if a key exists in an array. This is a PHP5-compatible Smarty modifier.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| (modifier input) | String/Integer | Required | - | The key to check |
| array | Array | Required | - | The array to check in |
Return Value
Returns true if the key exists in the array, false otherwise. Also returns false if the second parameter is not an array.
Usage Example
{if $key|array_key_exists:$array}Key exists{/if}
{* Check for numeric key *}
{if 0|array_key_exists:$array}First element exists{/if}Notes
- Checks for the existence of a key, not the value
- Returns
trueeven if the value associated with the key isnull - Returns
falseif the second parameter is not an array (safe handling) - PHP5-compatible: validates input types before calling the native
array_key_exists()function
---
implode
Joins array elements into a string using a delimiter. PHP7-compatible with flexible argument order.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| value1 | String or Array | Required | - | Either the separator string or the array to join |
| value2 | String or Array | Optional | null | Either the array to join or the separator string |
Return Value
Returns a string with all array elements joined by the delimiter. Returns an empty string '' if the array is null or empty. Returns null if the arguments don't match any supported pattern.
Usage Example
{* Standard argument order: separator|implode:array *}
{assign var='arr' value='["1","2","3"]'|json_decode}
{','|implode:$arr} {* Output: '1,2,3' *}
{* Omit separator (joins with empty string) *}
{$arr|@implode} {* Output: '123' *}
{* Legacy PHP7-compatible order: array|@implode:separator *}
{$arr|@implode:','} {* Output: '1,2,3' *}
{* Separator with null array (returns empty string) *}
{','|implode:null} {* Output: '' *}Notes
- Flexible argument order: Supports both standard and legacy (PHP7-compatible) argument orders
- Use
@modifier when passing an array as the first argument to prevent Smarty from iterating over it - Returns
nullif arguments don't match any of the supported patterns
---
join
Joins array elements into a string using a delimiter. This is an alias for the implode modifier with identical functionality.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| value1 | String or Array | Required | - | Either the separator string or the array to join |
| value2 | String or Array | Optional | null | Either the array to join or the separator string |
Return Value
Returns a string with all array elements joined by the delimiter. Returns an empty string '' if the array is null or empty. Returns null if the arguments don't match any supported pattern.
Usage Example
{* Standard argument order: separator|join:array *}
{assign var='arr' value='["1","2","3"]'|json_decode}
{','|join:$arr} {* Output: '1,2,3' *}
{* Omit separator (joins with empty string) *}
{$arr|@join} {* Output: '123' *}
{* Legacy PHP7-compatible order: array|@join:separator *}
{$arr|@join:','} {* Output: '1,2,3' *}
{* String input (returns the string as-is) *}
{assign var='str' value='foo'}
{$str|join} {* Output: 'foo' *}Notes
- Alias for
implode: Internally calls theimplodemodifier - Flexible argument order: Supports both standard and legacy (PHP7-compatible) argument orders
- Use
@modifier when passing an array as the first argument to prevent Smarty from iterating over it
---
explode
Splits a string into an array using a delimiter. PHP8-compatible with safe type handling.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| (modifier input) | String | Required | - | The delimiter to split by |
| string | String/Number | Required | - | The string to split |
Return Value
Returns an array of strings split by the delimiter. Returns an empty array [] if the string is empty or not a valid type.
Usage Example
{* Basic split *}
{','|explode:$csv_string}
{* Split path *}
{'/'|explode:$file_path}
{* Works with numeric input *}
{'-'|explode:12345}Notes
- Parameter order: Delimiter is the modifier input, string is passed after the colon
- Type coercion: Numeric types (int, float, double) are automatically converted to strings before splitting
- Type safety: Returns empty array for non-string/non-numeric input types (prevents PHP8 errors)
- Empty string handling: Returns empty array for empty strings
- Unlike
split, this modifier only supports literal delimiters (no regex support)
---
split
区切り文字を使用して文字列を配列に分割します。正規表現とリテラル区切り文字の両方をサポートします。
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| (modifier input) | String | Yes | - | 分割に使用する区切り文字 |
| string | String/Number | Yes | - | 分割する文字列 |
Return Value
文字列の配列を返します。文字列が空 ""、または有効な型でない場合は空の配列 [] を返します。
Usage Example
{* リテラル区切り文字での基本的な分割 *}
{','|split:$csv_string}
{* 正規表現パターンで分割(/で始まる必要あり) *}
{'/\s+/'|split:$text} {* 空白で分割 *}
{* 数値の分割(自動的に文字列に変換) *}
{'-'|split:12345} {* 数値入力も動作 *}Notes
- パラメータの順序は、区切り文字が修飾子入力、文字列はコロンの後に渡します。区切り文字が
/で始まり3文字以上の場合は正規表現としてpreg_split()を使用し、それ以外はexplode2()を使用します。
---
assign_array
配列をテンプレート変数に代入します。
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| var | String | Required | - | 配列を代入する変数名 |
| values | String | Required | - | 値のリスト(区切り文字で区切られた文字列) |
| delimiter | String | Optional | ',' | 区切り文字 |
| keys | String | Optional | - | 連想配列のキー(区切り文字で区切られた文字列) |
Return Value
var パラメータで指定した変数に配列が代入されます。keys を指定しない場合はインデックス配列、指定した場合は連想配列(既存の変数があれば追加/上書き)。
Usage Example
{* インデックス配列を作成 *}
{assign_array var="foo" values="bar1,bar2"}
{* 結果: ['bar1', 'bar2'] *}
{* カスタム区切り文字を使用 *}
{assign_array var="foo" values="bar1;bar2;bar3" delimiter=";"}
{* 結果: ['bar1', 'bar2', 'bar3'] *}
{* 連想配列を作成 *}
{assign_array var="foo" keys="key1,key2,key3" values="bar1,bar2,bar3"}
{* 結果: ['key1' => 'bar1', 'key2' => 'bar2', 'key3' => 'bar3'] *}
{* 単一のキーと値 *}
{assign_array var="foo" keys="key1" values="bar1"}
{* 結果: ['key1' => 'bar1'] *}Notes
varとvaluesパラメータは必須ですvaluesは文字列である必要があります(整数や小数は自動的に文字列に変換されます)keysを指定した場合、既存の変数が配列でなければ空配列から開始されますkeysを指定した場合、既存の配列に対して追加/上書きが行われます
---
assign_array_get
配列からキーで値を取得します。
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| var | String | Required | - | 結果変数名 |
| from | Array | Required | - | ソース配列 |
| key | String | Required | - | 取得するキー |
Return Value
varパラメータで指定した変数に取得した値が代入されます。
Usage Example
{assign_array_get var="foo" key="bar1" from=$row}Notes
- 指定したキーが存在しない場合はnullが代入されます
---
assign_array_set
配列に値を設定します。
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| var | String | Required | - | 変数名 |
| from | Array | Required | - | ソース配列 |
| key | String | Required | - | 設定するキー |
| value | any | Optional | - | 設定する値 |
Return Value
varパラメータで指定した変数に更新された配列が代入されます。
Usage Example
{assign_array_set var="foo" key="bar1" value="bar2" from=$row}Notes
- 既存のキーがある場合は上書きされます
- 元の配列は変更されず、新しい配列が作成されます
---
assign_array_unset
配列からキーを削除します。
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| var | String | Required | - | 変数名 |
| value | Array | Optional | - | ソース配列 |
| key | String/Array | Optional | - | 削除するキー(配列可) |
Return Value
varパラメータで指定した変数にキーが削除された配列が代入されます。
Usage Example
{assign_array_unset var="foo" value=$arr key=0}
{assign_array_unset var="foo" value=$arr key=['key1', 'key2']}Notes
- 複数のキーを配列で指定して一度に削除できます
- 元の配列は変更されず、新しい配列が作成されます
---
assign_array_diff
2つの配列の差分を取得します。
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| var | String | Required | - | 差分配列の変数名 |
| array1 | Array | Required | - | 1番目の配列 |
| array2 | Array | Required | - | 2番目の配列 |
| diff_mode | String | Optional | 'normal' | 差分モード: 'normal'または'key' |
Return Value
varパラメータで指定した変数に差分配列が代入されます。
Usage Example
{assign_array_diff var="foo" array1=$array1 array2=$array2 diff_mode='normal'}Notes
- diff_mode='normal'は値の差分を取得します
- diff_mode='key'はキーの差分を取得します
---
assign_array_intersect
2つの配列の共通部分を取得します。
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| var | String | Required | - | 共通部分配列の変数名 |
| array1 | Array | Required | - | 1番目の配列 |
| array2 | Array | Required | - | 2番目の配列 |
| intersect_mode | String | Optional | 'normal' | モード: 'normal', 'assoc', 'key' |
Return Value
varパラメータで指定した変数に共通部分の配列が代入されます。
Usage Example
{assign_array_intersect var="foo" array1=$array1 array2=$array2 intersect_mode='normal'}Notes
- intersect_mode='normal'は値の共通部分を取得します
- intersect_mode='assoc'はキーと値の両方が一致する要素を取得します
- intersect_mode='key'はキーの共通部分を取得します
---
assign_array_pick
配列から特定のキーを抽出します。
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| var | String | Required | - | 変数名 |
| from | Array | Required | - | ソース配列 |
| keys | String | Required | - | カンマ区切りのキー |
Return Value
varパラメータで指定した変数に抽出された配列が代入されます。
Usage Example
{assign_array_pick var="foo" keys="bar1,bar2,bar3" from=$row}Notes
- 指定したキーのみを含む新しい配列を作成します
- 存在しないキーは無視されます
---
rcms_sort
Sort an array.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| (input) | Array | Required | - | Array to sort |
Return Value
Sorted array.
Usage Example
{$array|@rcms_sort}Notes
- Equivalent to PHP's sort() function
- Sorts values in ascending order
- Keys are re-indexed
- Use the @ modifier for array operations
---
rcms_rsort
Sort an array in reverse order.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| (input) | Array | Required | - | Array to sort |
Return Value
Array sorted in descending order.
Usage Example
{$array|@rcms_rsort}Notes
- Equivalent to PHP's rsort() function
- Sorts values in descending order
- Keys are re-indexed
- Use the @ modifier for array operations
---
rcms_asort
Sort an array by values in ascending order while maintaining key association.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| (input) | Array | Required | - | Array to sort |
Return Value
Array sorted by values in ascending order with original keys preserved.
Usage Example
{* Sort array values ascending, keep keys *}
{$scores|@rcms_asort}
{* In a foreach loop *}
{foreach $scores|@rcms_asort as $name => $score}
{$name}: {$score}<br>
{/foreach}Notes
- Equivalent to PHP's asort() function
- IMPORTANT: Use the @ prefix for array modifiers
- Without @, Smarty tries to apply the modifier to each element
- Returns the input unchanged if not an array
- Original array keys are preserved in the result
---
rcms_arsort
Sort an array by values in descending order while maintaining key association.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| (input) | Array | Required | - | Array to sort |
Return Value
Array sorted by values in descending order with original keys preserved.
Usage Example
{* Sort array values descending, keep keys *}
{$scores|@rcms_arsort}
{* In a foreach loop *}
{foreach $scores|@rcms_arsort as $name => $score}
{$name}: {$score}<br>
{/foreach}Notes
- Equivalent to PHP's arsort() function
- IMPORTANT: Use the @ prefix for array modifiers
- Without @, Smarty tries to apply the modifier to each element
- Returns the input unchanged if not an array
- Original array keys are preserved in the result
---
rcms_ksort
Sort an array by key.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| (input) | Array | Required | - | Array to sort |
Return Value
Array sorted by keys in ascending order.
Usage Example
{$array|@rcms_ksort}Notes
- Equivalent to PHP's ksort() function
- Sorts array keys in ascending order
- Use the @ modifier for array operations
---
rcms_krsort
Sort an array by key in reverse order.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| (input) | Array | Required | - | Array to sort |
Return Value
Array sorted by keys in descending order.
Usage Example
{$array|@rcms_krsort}Notes
- Equivalent to PHP's krsort() function
- Sorts array keys in descending order
- Use the @ modifier for array operations
---
rcms_sort_by_key
Sort an array of associative arrays by a specific key.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| (input) | Array | Required | - | Array of arrays/objects to sort |
| key | String | Required | - | Key to sort by |
| order | String | Optional | 'asc' | Sort order ('asc' or 'desc') |
Return Value
Array sorted by the specified key.
Usage Example
{$array|@rcms_sort_by_key:'name':'asc'}Notes
- Sorts an array of associative arrays by a specific key
- Useful for sorting lists of records
- Use the @ modifier for array operations
---
json_decode
Decodes a JSON string into a PHP value.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| (modifier input) | String | Required | - | The JSON string to decode |
| assoc | Boolean | Optional | true | When true, returns associative arrays instead of objects |
Return Value
Returns the decoded value. By default, objects in JSON are decoded as associative arrays. Returns null if the input is not a string or if the JSON is invalid.
Usage Example
{* Basic usage - returns associative array by default *}
{assign var='data' value='{"name":"John","age":30}'|json_decode}
{$data.name} {* Output: John *}
{* Decode JSON array *}
{assign var='items' value='["apple","banana","orange"]'|json_decode}
{$items[0]} {* Output: apple *}
{* Return as object instead of array *}
{assign var='obj' value='{"name":"John"}'|json_decode:false}
{$obj->name} {* Output: John *}Notes
- Returns associative arrays by default (second parameter defaults to
true) - Type safety: Returns
nullif the input is not a string - Invalid JSON will return
null - Useful for parsing JSON data received from APIs or stored in database fields
---
rcms_json_encode
値をUnicodeサポート付きでJSON形式にエンコードし、RCMSコンテンツ境界の特別な処理を行います。
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| (modifier input) | any | Yes | - | エンコードする値 |
Return Value
エスケープされていないUnicode文字を含むJSONエンコード文字列を返します。
Usage Example
{* 基本的な使用例 *}
{$array|rcms_json_encode}
{* JavaScriptで使用 *}
<script>
var data = {$data|rcms_json_encode};
</script>
{* オブジェクトのエンコード *}
{$user_data|rcms_json_encode}Notes
JSON_UNESCAPED_UNICODEフラグを使用してUnicode文字(日本語など)をエスケープせずに保持します。__RCMS_CONTENT_BOUNDARY__マーカーを含む文字列を自動的にexplode2()で配列に分割する特別な処理があります。
---
to_object
配列をstdClassオブジェクトに変換します。
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| (modifier input) | Array | Yes | - | 変換する配列 |
Return Value
配列のキーに対応するプロパティを持つstdClassオブジェクトを返します。
Usage Example
{* 配列をオブジェクトに変換 *}
{assign var='obj' value=['name' => 'John', 'age' => 30]|@to_object}
{$obj->name} {* 出力: John *}
{* オブジェクトを期待するAPIに便利 *}
{assign var='request_body' value=$params|@to_object}Notes
- PHPの型キャスト
(object)$targetを使用します。連想配列のキーはオブジェクトプロパティになります。ネストした配列はネストしたオブジェクトには変換されません(浅い変換)。配列を渡す際は@修飾子を使用してください。
---
to_form_options
連想配列をフォームセレクト/オプション要素に適した形式に変換します。
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| (modifier input) | Array | Yes | - | 変換する連想配列 |
| key_name | String | No | 'key' | 出力でキーに使用するプロパティ名 |
| value_name | String | No | 'value' | 出力で値に使用するプロパティ名 |
Return Value
[['key' => $originalKey, 'value' => $originalValue], ...] 形式の連想配列の配列を返します。入力が配列でない場合は空の配列を返します。
Usage Example
{* デフォルトでの基本的な使用例 *}
{assign var='options' value=['a' => 'Apple', 'b' => 'Banana']|@to_form_options}
{* 結果: [['key' => 'a', 'value' => 'Apple'], ['key' => 'b', 'value' => 'Banana']] *}
{* カスタムプロパティ名 *}
{assign var='options' value=$status_map|@to_form_options:'id':'label'}
{* 結果: [['id' => ..., 'label' => ...], ...] *}Notes
- キー/値のペアを名前付きプロパティを持つオブジェクトの配列に変換します。配列を渡す際は
@修飾子を使用してください。
---
property_exists
オブジェクトまたはクラスにプロパティが存在するかチェックします。
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| (modifier input) | Object or String | Yes | - | チェック対象のオブジェクトインスタンスまたはクラス名 |
| property | String | Yes | - | チェックするプロパティ名 |
Return Value
プロパティが存在する場合は true、存在しない場合は false を返します。プロパティ名が文字列でない場合、または第一引数がオブジェクトでも文字列でもない場合も false を返します。
Usage Example
{* オブジェクトにプロパティがあるかチェック *}
{if $object|property_exists:'name'}Object has name property{/if}
{* クラス名でチェック *}
{if 'MyClass'|property_exists:'staticProperty'}Class has static property{/if}Notes
- パラメータの順序は、オブジェクト/クラスが修飾子入力、プロパティ名はコロンの後に渡します。プロパティの値に関係なく(nullでも)存在チェックを行います。
---
empty
Checks whether a value is empty, with enhanced handling for stdClass objects.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| (modifier input) | any | Required | - | The value to check |
Return Value
Returns true if the value is empty, false otherwise.
Usage Example
{if $value|empty}Value is empty{/if}
{* Works with objects too *}
{if $object|empty}Object has no properties{/if}Notes
- Empty values include: empty string
"",0,null,false, empty array[] - Enhanced stdClass handling: Also returns
truefor empty stdClass objects (objects with no properties) - This is different from PHP's native
empty()which would returnfalsefor an empty stdClass - Useful for conditional checks in templates, especially when dealing with API responses that may return empty objects
---
conv_bool
Converts a value to a boolean using the internal convBool() function.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| (modifier input) | any | Required | - | The value to convert |
Return Value
Returns a boolean value (true or false).
Usage Example
{$value|conv_bool}
{* Use in conditionals *}
{if $string_value|conv_bool}
Value is truthy
{/if}Notes
- Delegates to the internal
convBool()function for conversion - Useful for normalizing various truthy/falsy values to strict booleans
- Helpful when working with form inputs or API responses where boolean values may be represented as strings
---
認証・セキュリティプラグイン
目次
- rcms_auth - Show or hide content based on ...
- assign_session - セッションに値を代入します。
- assign_session_info - 現在のセッション情報を取得します。
- assign_login_log_list - ログインログ一覧を取得します。
- rcms_encrypt - データの暗号化および復号を行います。
- rcms_hash - ハッシュを生成します。
- secret - シークレット値を取得します。
---
rcms_auth
Show or hide content based on user resource permissions.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| target | String | Required | - | Permission target(s) in format "action:path" |
| not | Boolean | Optional | false | Invert the permission check result |
Return Value
Returns block content if user has permission (or lacks permission when not=true). Returns empty string if permission check fails.
Usage Example
{* Basic read permission check *}
{rcms_auth target="read:/topics/"}
<a href="/topics/">View Topics</a>
{/rcms_auth}
{* Check for insert OR update permission *}
{rcms_auth target="insert|update:/topics/"}
<a href="/topics/edit/">Edit Topics</a>
{/rcms_auth}
{* Inverted check - show when NO permission *}
{rcms_auth target="insert|update:/topics/" not=true}
<p>You do not have edit permission for topics.</p>
{/rcms_auth}Notes
- Uses RCMSUser::getResourceAuth($action, $path) for permission checking
- The || separator creates OR conditions between targets
- The | separator within actions means user needs ANY of those actions
- If target contains no :, defaults to "read" action
- When not=true, returns content only if ALL conditions fail
---
assign_session
セッションに値を代入します。
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| var | String | Optional | - | 変数名 |
| key | String | Conditional | - | セッション値のキー(最大100文字、varなしの場合は必須) |
| value | any | Optional | - | 設定する値 |
| unset | Boolean | Optional | - | trueの場合、値を削除 |
Return Value
valueを指定した場合は値がセッションに設定され、varを指定した場合はセッションから値が取得されます。
Usage Example
{assign_session key="key1" value="bar"}
{assign_session var="foo" key="key1"}
{assign_session key="key1" unset=true}Notes
$_SESSION["smarty_session"]に保存されます- 最大300KB
- セッション間でデータを保持できます
---
assign_session_info
現在のセッション情報を取得します。
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| var | String | Required | - | 変数名(最大100文字) |
Return Value
session_nameとsession_idを含む配列が代入されます。
Usage Example
{assign_session_info var="foo"}Notes
- セッション名とセッションIDを取得できます
- セッションの識別に使用します
---
assign_login_log_list
ログインログ一覧を取得します。
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| var | String | Required | - | 結果を代入する変数名 |
Return Value
varパラメータで指定した変数にログインログ一覧が代入されます。
Usage Example
{assign_login_log_list var="login_logs"}Notes
- バッチ処理内でのみ使用可能です
- ログイン履歴を取得できます
---
rcms_encrypt
データの暗号化および復号を行います。
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| action | String | Yes | - | 実行する操作(encrypt または decrypt) |
| data | String | Yes | - | 暗号化/復号するデータ |
| key | String | Yes | - | 暗号化キー(通常はsecret管理から取得) |
| var | String | No | - | 結果を代入する変数名 |
| sanitize | Boolean | No | true | 復号時にデータをサニタイズするかどうか |
Return Value
var パラメータを指定した場合、暗号化/復号されたデータが変数に代入されます。失敗時は false が代入されます。
Usage Example
{* シークレットキーを取得 *}
{secret var="encryption_key" key="MY_ENCRYPTION_KEY"}
{* データを暗号化 *}
{rcms_encrypt var="encrypted" action="encrypt" data=$sensitive_data key=$encryption_key}
{* データを復号 *}
{rcms_encrypt var="decrypted" action="decrypt" data=$encrypted key=$encryption_key}Notes
action、data、keyの3つのパラメータは必須です。actionはencryptまたはdecryptのいずれかである必要があります。内部的にencSecret()とdecSecret()関数を使用します。
---
rcms_hash
ハッシュを生成します。
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| var | String | Yes | - | 結果を代入する変数名 |
| data | String | Yes | - | ハッシュ化するデータ |
| algo | String | No | 'sha256' | ハッシュアルゴリズム |
| key | String | No | - | HMAC方式の場合の秘密鍵 |
| binary | Boolean | No | false | trueの場合、バイナリ形式で出力 |
Return Value
var パラメータで指定した変数にハッシュ値が代入されます。
Usage Example
{* 基本的なハッシュ(SHA-256) *}
{rcms_hash var='hash' data='hello world'}
{* MD5ハッシュ *}
{rcms_hash var='hash' data=$data algo='md5'}
{* HMAC-SHA256(秘密鍵付き) *}
{rcms_hash var='hmac' data=$message key=$secret_key algo='sha256'}
{* バイナリ出力 *}
{rcms_hash var='binary_hash' data=$data binary=true}Notes
var,algo,dataが必須です(いずれかが欠けている場合は何も実行されません)。keyを指定した場合、HMAC(Hash-based Message Authentication Code)が生成されます。
---
secret
シークレット値を取得します。
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| var | String | Yes | - | 結果を代入する変数名 |
| key | String | Yes | - | シークレットのキー名 |
Return Value
var パラメータで指定した変数にシークレット値が代入されます。
Usage Example
{* シークレット値を取得 *}
{secret var='api_key' key='EXTERNAL_API_KEY'}
{* 取得した値を使用 *}
{secret var='db_password' key='DB_PASSWORD'}
{api endpoint='https://api.example.com' headers=['Authorization: Bearer '|cat:$api_key] var='response'}Notes
varとkeyパラメータは必須です(未指定の場合はSmartyエラーがトリガーされます)。Kuroco管理画面のシークレット設定で登録した値を取得します。
---
ファイル操作プラグイン
目次
- write_file - ファイルにデータを書き込みます(一時ファイルまたは指定パス)...
- read_file - ファイルを1行ずつ読み込み、各行を繰り返し処理します。
- read_dir - KurocoFiles内のディレクトリを読み込み、ファイルリ...
- put_file - ファイルをクラウドストレージまたはKurocoFilesにア...
- get_file - ファイルを取得します。
- save_file - 一時ファイルとしてコンテンツを保存します。
- remove_file - ファイルを削除します。
- remove_dir - ディレクトリを削除します。
- rename_file - S3/GCS上のファイルを移動(リネーム)します。
- zip - クラウドファイルをZIP圧縮してクラウドストレージにアップロ...
- unzip - ZIPファイルを解凍してクラウドストレージにアップロードしま...
- storage_url - クラウドストレージ上のファイルへの署名付きURLを取得します...
- rcms_file_exists - Check if a file exists at the ...
- rcms_file_mtime - Get the last modification time...
- rcms_file_size - Get the file size.
- generate_pdf - PDFを生成します。
- make_pdf_thumb - PDFのサムネイルを作成します。
- detect_document_text - PDF/TIFFファイルからテキストを検出(OCR)します。
---
write_file
ファイルにデータを書き込みます(一時ファイルまたは指定パス)。
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| var | String | Conditional | - | 書き込んだファイルパスを格納する変数名(新規作成時は必須) |
| path | String | Conditional | - | ファイルパス(TEMP_DIR2からの相対パス)。未指定時は一時ファイルが作成される |
| value | any | Yes | - | 書き込む内容(配列の場合はCSV形式) |
| encoding | String | No | - | エンコーディング(配列→CSV変換時に使用) |
| is_append | Boolean | No | false | trueの場合、ファイルに追記 |
Return Value
var パラメータで指定した変数にファイルパスが代入されます。
Usage Example
{* 新規一時ファイルに書き込み *}
{write_file var=path value="Hello World"}
{* 指定パスに書き込み *}
{write_file path="myfile.txt" value="Content here"}
{* ファイルに追記 *}
{write_file path=$existing_path value="New line" is_append=1}
{* 配列をCSV形式で書き込み *}
{write_file var=csv_path value=$row_array encoding="UTF-8"}Notes
- 新規作成時で
pathが未指定の場合、varパラメータは必須です。追記モード時はpathが必須です。valueが配列の場合、CSV形式の文字列に変換されます。
---
read_file
ファイルを1行ずつ読み込み、各行を繰り返し処理します。
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| name | String | Yes | - | read_fileブロックの識別名(一意である必要あり、同名のネスト不可) |
| path | String | Yes | - | ファイルパス(サポートされるパス: /files/user/、/files/ltd/、/files/topics/、/files/member/、/files/temp/、TEMP_DIR2からの相対パス) |
| row | String | Yes | - | 行データを代入するSmarty変数名 |
| type | String | No | 'txt' | フォーマットタイプ: 'txt'、'csv'、または 'jsonl' |
| ignore_permission | Boolean | No | false | true でtopics/memberファイルの権限チェックをバイパス |
Return Value
各行が row 変数に代入されて繰り返されます。txt タイプは文字列、csv タイプは配列(fgetcsv() でパース)、jsonl タイプは配列/オブジェクト(JSONデコード)。
Usage Example
{* テキストファイルを読み込み *}
{read_file name="log" path='/files/user/data.txt' row="line"}
{$line|escape}
{/read_file}
{* CSVファイルを読み込み *}
{read_file name="csv" path='/files/user/data.csv' row="row" type="csv"}
{$row[0]} - {$row[1]} - {$row[2]}
{/read_file}
{* JSON Linesファイルを読み込み *}
{read_file name="jsonl" path='/files/user/data.jsonl' row="item" type="jsonl"}
{$item.name}: {$item.value}
{/read_file}Notes
- 最大10万行まで読み込み(無限ループ防止)。NULL文字を含むバイナリファイルは拒否されます。
nameパラメータは一意である必要があります。
---
read_dir
KurocoFiles内のディレクトリを読み込み、ファイルリストを繰り返し処理します。
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| name | String | Yes | - | read_dirブロックの識別名(一意である必要あり、同名のネスト不可) |
| file_var | String | Yes | - | ファイルデータを代入するSmarty変数名 |
| path | String | Yes | - | 対象ディレクトリパス(/files/user または /files/ltd 配下である必要あり) |
| pattern | String | No | - | ファイルパスをフィルタする正規表現パターン |
| recursive | Boolean | No | false | true でサブディレクトリを再帰的に取得 |
| name_only | Boolean | No | false | true でファイルパス文字列のみ返す。false でファイル情報配列を返す |
| type | String | No | - | タイプでフィルタ: 'file' でファイルのみ、'dir' でディレクトリのみ |
Return Value
各ファイル/ディレクトリが file_var 変数に代入されて繰り返されます。name_only=false(デフォルト)の場合は path、size、ctime、mtime、is_dir を含む連想配列。name_only=true の場合は相対パス文字列のみ。
Usage Example
{* 基本的なディレクトリリスト *}
{read_dir name="files" file_var='file' path='/files/user/uploads'}
{$file.path} - {$file.size} bytes
{/read_dir}
{* ファイルタイプフィルタ付き再帰リスト *}
{read_dir name="images" file_var='f' path='/files/user/images' recursive=true type='file'}
<img src="{$f.path}" />
{/read_dir}
{* 正規表現パターンでフィルタ *}
{read_dir name="pdfs" file_var='doc' path='/files/user/docs' pattern='/\.pdf$/i'}
<a href="{$doc.path}">{$doc.path}</a>
{/read_dir}Notes
/files/userまたは/files/ltd配下のパスのみ許可されます(is_public_file()で検証)。nameパラメータは一意である必要があります。隠しファイル/フォルダは自動的にフィルタされます。
---
put_file
ファイルをクラウドストレージまたはKurocoFilesにアップロードします。
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| path | String | Yes | - | アップロード先のパス |
| tmp_path | String | Conditional | - | 一時ファイルパス(TEMP_DIR2からの相対パス) |
| files_path | String | Conditional | - | KurocoFilesパス(例: /files/user/**, /files/ltd/**) |
| value | String | No | - | 直接書き込むコンテンツ |
| bucket | String | No | S3BUCKET | S3バケット名 |
Return Value
なし(ファイルがアップロードされます)
Usage Example
{* 一時ファイルをアップロード *}
{put_file tmp_path=$tmp_path path="/files/user/uploaded.txt"}
{* 直接コンテンツを書き込み *}
{put_file value="File content here" path="/files/user/new_file.txt"}
{* KurocoFilesから別の場所にコピー *}
{put_file files_path="/files/user/source.txt" path="/files/ltd/dest.txt"}
{* 外部S3バケットにアップロード *}
{put_file tmp_path=$tmp_path path="/custom/path/file.txt" bucket="my-custom-bucket"}
{* クラウドストレージパスにアップロード *}
{put_file value=$content path="/files/g/private/data.json"}Notes
tmp_pathとfiles_pathは同時に指定できません(エラーになります)。アップロード先として許可されているパス: クラウドストレージパス(isCloudFilePath()でチェック)、/files/user/以下、/files/temp/以下、/files/ltd/以下。バリデーションモード(_rcms_validate)の場合、実際のアップロードは実行されません。
---
get_file
ファイルを取得します。
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| path | String | Required | - | ファイルパス |
| var | String | Optional | - | 結果変数 |
| bucket | String | Optional | - | バケット名 |
Return Value
varパラメータで指定した変数にファイル内容が代入されます。
Usage Example
{get_file path="/files/user/data.txt" var="content"}Notes
- KurocoFilesまたはS3からファイルを取得します
- bucketパラメータで別のS3バケットを指定できます
---
save_file
一時ファイルとしてコンテンツを保存します。
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| var | String | Yes | - | 保存したファイルのパスを代入する変数名 |
| value | String | Yes | - | 保存するコンテンツ |
Return Value
var パラメータで指定した変数に、保存された一時ファイルのパス(TEMP_DIR2からの相対パス)が代入されます。
Usage Example
{* 基本的な使用例 *}
{save_file var="file_path" value="Hello, World!"}
<p>保存先: {$file_path}</p>
{* 変数の内容を保存 *}
{save_file var="csv_path" value=$csv_content}
{* 保存したファイルをS3にアップロード *}
{save_file var="temp_path" value=$file_content}
{put_file tmp_path=$temp_path path="/files/user/uploaded.txt"}Notes
varパラメータは必須です(未指定の場合は何も実行されません)。ファイルは TEMP_DIR2 ディレクトリに一時ファイルとして保存されます。
---
remove_file
ファイルを削除します。
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| path | String | Yes | - | 削除するファイルのパス |
| bucket | String | No | S3BUCKET | S3/GCSバケット名 |
| status_var | String | No | - | 削除結果を代入する変数名 |
Return Value
status_var パラメータを指定した場合、削除の成功(true)または失敗(false)が変数に代入されます。
Usage Example
{* 基本的な使用例 *}
{remove_file path="/files/user/old_data.txt"}
{* 結果を取得 *}
{remove_file path="/files/user/temp.txt" status_var="result"}
{if $result}
<p>ファイルを削除しました</p>
{else}
<p>削除に失敗しました</p>
{/if}
{* 外部S3バケットのファイルを削除 *}
{remove_file path="/custom/path/file.txt" bucket="my-custom-bucket" status_var="result"}Notes
- 削除可能なパス: クラウドストレージパス(S3/GCS)、/files/user/、/files/temp/、/files/ltd/ 以下。
---
remove_dir
ディレクトリを削除します。
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| path | String | Yes | - | 削除するディレクトリのパス |
| status_var | String | No | - | 削除結果を代入する変数名 |
Return Value
status_var パラメータを指定した場合、削除の成功(true)または失敗(false)が変数に代入されます。
Usage Example
{* 基本的な使用例 *}
{remove_dir path="/files/user/temp_folder"}
{* 結果を取得 *}
{remove_dir path="/files/user/old_directory" status_var="result"}
{if $result}
<p>ディレクトリを削除しました</p>
{else}
<p>削除に失敗しました</p>
{/if}Notes
- 削除可能なパス: /files/user/、/files/temp/、/files/ltd/ 以下。ディレクトリは空である必要があります(PHPの
rmdir()を使用するため)。
---
rename_file
S3/GCS上のファイルを移動(リネーム)します。
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| src_path | String | Yes | - | 移動元のファイルパス |
| dest_path | String | Yes | - | 移動先のファイルパス |
Return Value
なし
Usage Example
{* 基本的なファイル移動 *}
{rename_file src_path="/files/user/old_name.txt" dest_path="/files/user/new_name.txt"}
{* ディレクトリ間の移動 *}
{rename_file src_path="/files/temp/uploaded.pdf" dest_path="/files/user/documents/final.pdf"}
{* 動的なパスを使用 *}
{rename_file src_path=$temp_file_path dest_path="/files/user/{$user_id}/profile.jpg"}Notes
- 内部的に
RCMS_AWSClient::moveS3File()を使用してS3/GCS上のファイルを移動します。バリデーションモード(_rcms_validate)の場合、実際の移動は実行されません。
---
zip
クラウドファイルをZIP圧縮してクラウドストレージにアップロードします。
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| entries | Array | Yes | - | 圧縮するファイルリスト(各要素は url と name を含む配列) |
| dest | String | No | files/temp/{UUID}.zip | 出力先ZIPファイルパス |
| bucket | String | No | S3BUCKET | S3バケット名 |
| callback_batch | String | No | - | 圧縮完了時に実行するバッチの識別子 |
| data | Array | No | [] | コールバックバッチに引き継がれるデータ |
Return Value
zip_dest 変数にZIPファイルの出力パスが自動的に代入されます。
Usage Example
{* ファイルリストを作成 *}
{assign var=entries value=[]}
{assign var=entry value=['url' => '/files/user/doc1.pdf', 'name' => 'document1.pdf']}
{append var=entries value=$entry}
{* ZIPファイルを作成 *}
{zip entries=$entries dest='/files/user/archive.zip'}
{* 出力パスを使用 *}
<a href="{$zip_dest}">Download ZIP</a>Notes
entries配列の各要素はurl(ファイルURL)とname(ZIP内でのファイル名)を含む連想配列である必要があります。destを省略すると一時ファイルが自動生成されます。処理はGoogle Cloud Pub/Subを使用して非同期で実行されます。
---
unzip
ZIPファイルを解凍してクラウドストレージにアップロードします。
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| src | String | Yes | - | 解凍するZIPファイルのパスまたはURL |
| dest | String | Yes | - | 展開先ディレクトリパス |
| bucket | String | No | S3BUCKET | S3バケット名 |
| overwrite | Boolean | No | false | 既存ファイルを上書きするかどうか |
| callback_batch | String | No | - | 解凍完了時に実行するバッチの識別子 |
| detect_order | Array | No | ["utf8", "cp932", "EUC-JP"] | ファイル名のエンコーディング検出順序 |
| data | Array | No | [] | コールバックバッチに引き継がれるデータ |
Return Value
なし(ファイルが展開されます)
Usage Example
{* 基本的な使用例 *}
{unzip src='/files/user/archive.zip' dest='/files/user/extracted/'}
{* 上書きモードで解凍 *}
{unzip src='/files/user/archive.zip' dest='/files/user/extracted/' overwrite=1}
{* コールバック付きで解凍 *}
{unzip src='/files/user/archive.zip' dest='/files/user/extracted/' callback_batch='process_files' data=$metadata}Notes
- 展開先として許可されているパスは
/files/user/、/files/temp/、/files/ltd/以下です。処理はGoogle Cloud Pub/Subを使用して非同期で実行されます。Firebase認証情報とPub/Sub認証情報が必要です。
---
storage_url
クラウドストレージ上のファイルへの署名付きURLを取得します。
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| var | String | Yes | - | 結果を代入する変数名 |
| path | String | Yes | - | ファイルパス |
| expire | String | No | - | 有効期限(strtotime形式、例: "+1 hour") |
| chk_file_exists | Boolean | No | true | ファイル存在チェックを行うかどうか |
Return Value
var パラメータで指定した変数に署名付きURLが代入されます。ファイルが存在しない場合(chk_file_exists=true の時)は null が代入されます。
Usage Example
{* 基本的な使用例 *}
{storage_url var="url" path="/files/user/document.pdf"}
<a href="{$url}">ダウンロード</a>
{* 有効期限を指定 *}
{storage_url var="url" path="/files/user/image.jpg" expire="+1 hour"}
{* ファイル存在チェックを無効化 *}
{storage_url var="url" path="/files/temp/generated.pdf" chk_file_exists=false}Notes
varとpathの両方が必須です。chk_file_exists=true(デフォルト)の場合、ファイルが存在しないと null が代入されます。内部的にRCMS_AWSClient::getS3Url()を使用します。
---
rcms_file_exists
Check if a file exists at the specified path.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| (input) | String | Required | - | File path to check |
Return Value
Boolean: true if file exists, false otherwise.
Usage Example
{* Check if image exists before displaying *}
{if $image_path|rcms_file_exists}
<img src="{$image_path}" alt="Image">
{else}
<img src="/images/placeholder.png" alt="No image">
{/if}Notes
- Wrapper around PHP's file_exists() function
- Returns false for empty/null input
- Works with both files and directories
- Does not check if file is readable, only existence
- Useful for graceful fallbacks and conditional includes
---
rcms_file_mtime
Get the last modification time of a file as a Unix timestamp.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| (input) | String | Required | - | File path to check |
Return Value
Integer Unix timestamp of the file's last modification time, or false if file doesn't exist.
Usage Example
{* Cache busting for CSS/JS files *}
<link rel="stylesheet" href="/css/style.css?v={"/css/style.css"|rcms_file_mtime}">
{* Display last updated date *}
{assign var='mtime' value=$file_path|rcms_file_mtime}
{if $mtime}
<p>Last updated: {$mtime|date_format:'%Y-%m-%d %H:%M'}</p>
{/if}Notes
- Wrapper around PHP's filemtime() function
- Returns false if file doesn't exist (check with rcms_file_exists first)
- Timestamp is in server's timezone
- Combine with date_format modifier for human-readable dates
- Useful for cache busting without manual version numbers
---
rcms_file_size
Get the file size.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| (input) | String | Required | - | File path |
Return Value
File size in bytes.
Usage Example
{$path|rcms_file_size}Notes
- Returns the file size in bytes
- Use with number_format for human-readable output
---
generate_pdf
PDFを生成します。
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| var | String | Optional | - | 結果を代入する変数名 |
| template | String | Required | - | テンプレートパス |
| output | String | Optional | - | 出力パス |
Return Value
varパラメータで指定した変数に生成結果が代入されます。
Usage Example
{generate_pdf template="/templates/invoice.html" output="/files/user/invoice.pdf" var="result"}Notes
- HTMLテンプレートからPDFを生成します
---
make_pdf_thumb
PDFのサムネイルを作成します。
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| path | String | Yes | - | PDFファイルパス |
| output | String | Yes | - | 出力パス |
| var | String | No | - | 結果を代入する変数名 |
Return Value
varパラメータで指定した変数にサムネイル作成結果が代入されます。
Usage Example
{make_pdf_thumb path="/files/user/document.pdf" output="/files/user/thumb.png" var="result"}Notes
- PDFの最初のページからサムネイル画像を生成します
---
detect_document_text
PDF/TIFFファイルからテキストを検出(OCR)します。
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| var | String | Required | - | 結果を代入する変数名 |
| path | String | Required | - | ファイルパス |
Return Value
varパラメータで指定した変数に検出されたテキストが代入されます。
Usage Example
{detect_document_text var="text" path="/files/user/document.pdf"}Notes
- PDF/TIFFファイルからOCRでテキストを抽出します
- Google Cloud Vision APIを使用します
---
Related skills
How it compares
Use instead of generic PHP/Smarty snippets—this is Kuroco-specific plugin catalog knowledge, not a universal CMS skill.
FAQ
Who is kuroco-server-processing for?
Developers and integrators using Kuroco CMS who need AI agents to navigate Smarty plugins for APIs, forms, auth, and external services during implementation.
When should I use kuroco-server-processing?
Use it in Build integrations when adding server-side data fetch, credential signing, OpenAI helpers, array/string transforms, or Vue-linked template behavior in Kuroco.
Is kuroco-server-processing safe to install?
Check the Security Audits panel on this Prism page and review diverta/kuroco-skills source; plugins may trigger network calls and secrets handling in your Kuroco environment—test in staging first.