主なパラメータ

&config

よく使うパラメータセットをconfigurationファイルとしてまとめておき、必要に応じて呼び出すことができます。
Values : default.config.php in ditto/configs folder
デフォルト値 : default (中身が空のdefault.config.phpを読み込んでます)
使い方 : [[Ditto?config=config名]]
Notes : /assets/snippets/ditto/configs/ ディレクトリ内にconfig名.config.php として配置します。このファイルは普通のphpファイルとして機能しますので、各パラメータの値を動的に生成するような使い方もできます。

&dateFormat

[+date+]プレースホルダの出力形式を指定します。
Values : PHPの strftime() 関数の書式を用います。
Default : 何も指定しない場合は languageファイルで指定された書式が用いられます。
使い方 : [[Ditto?dateFormat=%Y年%m月%d日]]
Notes : [+date+]プレースホルダではなく[+createdon+]や[+editedon+]を使う場合はPHxモディファイアを通せば同じように使えます。たとえば[+createdon:date=`%Y年%m月%d日`+]というふうに記述します。

&dateSource

[+date+]プレースホルダと関連付けるフィールドを指定します。
Values : [*createdon+] [*publishedon*] [*editedon*] [*任意のテンプレート変数*]から選べます。
デフォルト値 : createdon
使い方 : [[Ditto?dateSource=editedon]]
Notes : 値がUNIX timestamp形式で管理されているフィールドを指定する必要があります。そのため、テンプレート変数を指定する場合はUnixtimeウィジェットを設定してください。

&debug

デバッグコンソールを使えるようにします(どういうものかは、試してみると分かります)。文字化けのバグがありますが、MODX1.0.5J-r8で修正されました。
Values : 0,1
使い方 : [[Ditto?debug=1]]
Default : 0

&depth

取得対象とするリソースの階層数を指定。Wayfinderの&levelパラメータに相当します。デフォルトでは直下の1階層のみを取得します。
Values : positive integer
Default : 1
使い方 : [[Ditto?depth=3]]
Notes : 0をセットすると階層無限です

&display

取得したリソースのうち、何件を表示するかを指定します。ページング制御をしている時に、ページあたり何件を表示するかを指定するパラメータです。
Values : 整数値または「all」
使い方 : [[Ditto?display=10]]
Default : all

&ditto_base

Ditto本体ファイルを置いているディレクトリを設定します。改造したDitto本体を使いたい場合にこのパラメータを用います。
Default : [(base_path)]assets/snippets/ditto/
使い方 : [[Ditto?ditto_base=assets/snippets/ditto_custom/]]
Notes :末尾をスラッシュで閉じてください。(MODXのパス指定は基本的にスラッシュで閉じるスタイルです)

&documents

一覧表示したいリソースを静的に指定します。リソースIDはコンマで区切って複数指定します。このパラメータを指定すると&parentsの指定は無効になります。また、メニューの表示・非表示に関係なく取得します。
Values : IDをコンマで区切って指定します
Default : ブランク(指定なし)
使い方 : [[Ditto?documents=3,7,8]]
Notes : &parentsの指定を無視します

&extenders

エクステンダーを組み込んでDittoの機能を拡張します。追加したい機能をこのパラメータで指定します。
Values : Comma-separated list of names
Default : blank
使い方 : [[Ditto?extenders=summary,request]]
Notes : File name in extenders folder is <name>.extender.inc.php

&format

出力フォーマットの指定。プリセット型のconfig・パターンの組み合わせのようなもので、ここでパラメータを指定するだけで、必要な出力を得ることができます。通常のDittoコールと違って、ヘッダ・フッタに相当するブロックの出力も行ないます。
Values : `html`,`json`,`xml`,`atom`,`rss`
Default : `html`

デフォルトは「html」になっていますが、

<?php
$header = "";
$footer = "";
?>

「html」フォーマットの実際の処理は上記のような空処理になっており、何も指定していないのと同等です。

&hiddenFields

Purpose : Allow Ditto to retrieve fields its template parser cannot handle such as nested placeholders
Values : Comma-separated list of field and template variable names
Default : empty
Notes : (I have not investigated this one yet)

&hideFolders

Purpose : Hide retrieved documents with children of their own
Values : 1,0
Default : 0

&hidePrivate

Purpose : Don't show documents the guest or user does not have permission to see
Values : 1,0
Default : 1

&id

ページ内で複数のDittoインスタンスを実行する場合は、各インスタンスにIDを割り当てて処理を区別する必要があります。
Values : 半角英数字及びアンダーバーで構成される文字列
Default : blank
Notes : 大文字小文字を区別します。

&keywords

Purpose : MODXのグローバル設定でMETAタグ機能を有効にしている場合、keyword属性を取得します。
Values : 1,0
Default : 0
Notes : MODX本体のMETAタグ機能は1.0.15Jで廃止されました。そのため当パラメータは動作しません

&language

Purpose : 取得対象リソースがなかった場合の「記事はありません」や、ページ分割機能を有効にした場合の「戻る」「次へ」などで用いるDitto言語ファイルを指定します。デバッグメッセージ・エラーメッセージもこれに含まれます。
Values : Any language name with a corresponding file in the &ditto_base/lang folder
Default : `english`
Notes : Affects prepositions etc. on dates but NOT language of month names (which is a system setting)

&localFilterDelimiter

Purpose : Delimiter used to separate individual parameters within each filter string
Values : Any character not used in the filter itself
Default : comma
Notes : Needed if commas are part of the data within a filter string

&noResults

Purpose : Text or chunk to display when there are no results
Values : Chunk name or text
Default : 言語ファイルの$_lang['no_documents']エントリー
Notes : 「記事はありません。」

&orderBy

Purpose : Order and direction by which to sort the results
Values : Comma-separated list
Default : `createdon DESC`
Notes : Supersedes &sortBy and &sortDir.

&parents

Purpose : ID(s) of documents containing documents and sub-folders from which to retrieve data
Values : Comma-separated list of IDs
Default : current document
Notes : Supersedes &startId (which could only have single value)

&phx

Purpose : Use built-in PHx functions
Values : 0,1
Default : 1

&queryLimit

Purpose : Number of documents to retrieve from the database (same as MySQL LIMIT)
Values : positive integer
Default : 0
Notes : Zero indicates 'retrieve all'. Used with &where parameter only

&randomize

Purpose : Randomize the order of the output
Values : 1,0
Default : 0
Notes : Beware caching issues!

&removeChunk

Purpose : Name of chunks to be stripped from content
Values : Comma-separated list
Default : empty
Notes : (I have not investigated this one yet)

&save

Purpose :

Dittoが自らの出力のために取得する各パラメータ値を、他のスニペットで用いることができるようにプレースホルダに代入します。オブジェクトとして代入するため、通常の[+プレースホルダ+]でアクセスすることはできません。
$modx->placeholdersのprint_rを行なうスニペットを仮に作って、saveパラメータの値を0-3に設定して出力の違いを見ることでそれぞれの処理を確認できます。

Ditto単体では難しい複雑なパターン出力を実装したい場合は、&save=3をセットし、Dittoで取得した値を他のスニペットで処理するとよいでしょう。慣れればDittoを拡張APIのように用いることができます。

取得したリソースの値は
$modx->getPlaceholder('ditto_resource')または$modx->placeholders['ditto_resource']
で参照できます(&save=2または3)。

Values : 0(代入しない),1(取得したリソース情報以外を代入),2(全て代入),3(全て代入・Ditto自体の出力はオフ)
Default : 0
Notes : (I have not investigated this one yet)

http://forums.modx.com/thread/42554/#dis-post-246265
http://forums.modx.com/thread/41824/#dis-post-242521
使い方の実例

&seeThruUnpub

Purpose : See through unpublished folders to retrieve their children (when &depth > 1)
Values : 1,0
Default : 0

&showInMenuOnly

Purpose : Show only documents visible in the menu
Values : 1,0
Default : 0

&showPublishedOnly

Purpose : Show only published documents
Values : 1,0
Default : 1

&start

Purpose : Number of documents to skip in the results
Values : positive integer
Default : 0

&tagData

Purpose : Field containing tagging information
Values : Document field or template variable
Default : empty
Notes : Setting this automatically adds in the tagging extender

&total

Purpose : Number of documents to retrieve from the database
Values : Number, or `all`
Default : `all`

&where

Purpose : Custom MySQL WHERE statement (instead of folder or document-based retrieval)

PR

  • KAGOYA
  • ASP at AKIHABARA Japan
  • CMS AWARDS 2007 Winner
ページトップへ