MODx Ditto Snippet Documentation
MODx Ditto Snippet Documentation
Description
Snippet
Aggregates documents to create blogs, article/news collections,
and more,with full support for templating.
Snippet
Author
Mark Kaplan for MODx CMF
Wordpress Config
Version
2.1.0
Template Class
Summary
Variables
extenders Array that can be added to by
configs or formats to load that
extender
placeholders Initialize custom placeholders
array for configs or extenders to
add to
filters Holds both the custom filters array
for configs or extenders to add to
and the parsed filters array.
orderBy An array that holds all criteria to
sort the result set by.
idType type of IDs provided; can be either
parents or documents
1 of 22
Parameters
parents IDs of containers for Ditto to
retrieve their children to &depth
depth
documents IDs of documents for Ditto to
retrieve
Variables
IDs Internal variable which holds the
set of IDs for Ditto to fetch
Parameters
depth Number of levels deep to retrieve
documents
paginate Paginate the results set into pages
of &display length.
dateSource Source of the [+date+]
placeholder
dateFormat Format the [+date+] placeholder
in human readable form
display Number of documents to display in
the results
total Number of documents to retrieve
showPublishedOnly Show only published documents
showInMenuOnly Show only documents visible in the
menu
hideFolders Don’t show folders in the returned
results
hidePrivate Don’t show documents the guest
or user does not have permission
to see
seeThruUnpub See through unpublished folders to
retrive their children Used when
depth is greater than 1
queryLimit Number of documents to retrieve
from the database, same as
MySQL LIMIT
where Custom MySQL WHERE statement
noResults Text or chunk to display when
there are no results
removeChunk Name of chunks to be stripped
from content separated by
commas
hiddenFields Allow Ditto to retrieve fields its
template parser cannot handle
such as nested placeholders and
[fields]
start Number of documents to skip in
the results
globalFilterDelimiter Filter delimiter used to separate
filters in the filter string
localFilterDelimiter Delimiter used to separate
individual parameters within each
filter string
2 of 22
filter Removes items not meeting a
critera.
keywords Enable fetching of associated
keywords for each document Can
be used as [+keywords+] or as a
tagData source
randomize Randomize the order of the output
save Saves the ditto object and results
set to placeholders for use by
other snippets
tpl User defined chunk to format the
documents
tplAlt User defined chunk to format
every other document
tplFirst User defined chunk to format the
first document
tplLast User defined chunk to format the
last document
tplCurrentDocument User defined chunk to format the
current document
orderBy Sort the result set
paginateAlwaysShowLinks Determine whether or not to
always show previous next links
paginateSplitterCharacter Splitter to use if always show is
disabled
tplPaginatePrevious Template for the previous link
tplPaginateNext Template for the next link
tplPaginateNextOff Template for the inside of the next
link
tplPaginatePreviousOff Template for the previous link
when it is off
tplPaginatePage Template for the page link
tplPaginateCurrentPage Template for the current page link
Placeholders
item[x] Individual items rendered output
ditto_base
Purpose
Location of Ditto files
Options
Any valid folder location containing the Ditto source code with
a trailing slash
Default
3 of 22
[(base_path)]assets/snippets/ditto/
id
Purpose
Unique ID for this Ditto instance for connection with other
scripts (like Reflect) and unique URL parameters
Options
Any combination of characters a-z, underscores, and numbers
0-9
Note
This is case sensitive
Default
”” blank
language
Purpose
language for defaults, debug, and error messages
Options
Any language name with a corresponding file in the
&ditto_base/lang folder
Default
”english”
format
Purpose
Output format to use
Options
”html”
”json”
”xml”
”atom”
”rss”
Default
4 of 22
”html”
config
Purpose
Load a custom configuration
Options
”default” default blank config file
CONFIG_NAME Other configs installed in the configs
folder or in any folder within the
MODx base path via @FILE
Default
”default”
Related
extenders
debug
Purpose
Output debugging information
Options
0 off
1 on
Default
0 off
Related
debug
phx
Purpose
Use PHx formatting
Options
0 off
5 of 22
1 on
Default
1 on
extenders
Purpose
Load an extender which adds functionality to Ditto
Options
Any extender in the extenders folder or in any folder within
the MODx base path via @FILE
Default
[NULL]
Related
config
Variables
extenders
placeholders
filters
6 of 22
orderBy
An array that holds all criteria to sort the result set by. Note
that using a custom sort will disable all other sorting.
$orderBy["parsed"][] = array("sortBy","sortDir");
$orderBy["custom"][] = array("sortBy","callback_function");
idType
parents
Purpose
IDs of containers for Ditto to retrieve their children to &depth
depth
Options
Any valid MODx document marked as a container
Default
Current MODx Document
Related
documents
depth
documents
Purpose
IDs of documents for Ditto to retrieve
Options
Any valid MODx document marked as a container
Default
None
7 of 22
Related
parents
Variables
IDs
Internal variable which holds the set of IDs for Ditto to fetch
depth
Purpose
Number of levels deep to retrieve documents
Options
Any number greater than or equal to 1 0 - infinite depth
Default
1
Related
seeThruUnpub
8 of 22
paginate
Purpose
Paginate the results set into pages of &display length. Use
&total to limit the number of documents retreived.
Options
0 off
1 on
Default
0 off
Related
paginateAlwaysShowLinks
paginateSplitterCharacter
display
dateSource
Purpose
Source of the [+date+] placeholder
Options
# Any UNIX timestamp from MODx fields or TVs
such as createdon, pub_date, or editedon
Default
”createdon”
Related
dateFormat
dateFormat
Purpose
Format the [+date+] placeholder in human readable form
Options
Any PHP valid strftime option
Default
[LANG]
9 of 22
Related
dateSource
display
Purpose
Number of documents to display in the results
Options
# Any number
”all” All documents found
Default
3
Related
queryLimit
total
total
Purpose
Number of documents to retrieve
Options
# Any number
”all” All documents found
Default
”all” All documents found
Related
display
queryLimit
showPublishedOnly
Purpose
Show only published documents
Options
0 show only unpublished documents
10 of 22
1 show both published and unpublished
documents
Default
1 show only published documents
Related
seeThruUnpub
hideFolders
showPublishedOnly
where
showInMenuOnly
Purpose
Show only documents visible in the menu
Options
0 show all documents
1 show only documents with the show in menu
flag checked
Default
0 show all documents
Related
seeThruUnpub
hideFolders
where
11 of 22
hideFolders
Purpose
Don’t show folders in the returned results
Options
0 keep folders
1 remove folders
Default
0 keep folders
Related
seeThruUnpub
showInMenuOnly
where
hidePrivate
Purpose
Don’t show documents the guest or user does not have
permission to see
Options
0 show private documents
1 hide private documents
Default
1 hide private documents
Related
seeThruUnpub
showInMenuOnly
where
seeThruUnpub
Purpose
See through unpublished folders to retrive their children Used
when depth is greater than 1
Options
0 off
1 on
12 of 22
Default
0 off
Related
hideFolders
showInMenuOnly
where
queryLimit
Purpose
Number of documents to retrieve from the database, same as
MySQL LIMIT
Options
# Any number
0 automatic
Default
0 automatic
Related
where
where
Purpose
Custom MySQL WHERE statement
Options
A valid MySQL WHERE statement using only document object
items (no TVs)
Default
[NULL]
Related
queryLimit
noResults
Purpose
Text or chunk to display when there are no results
13 of 22
Options
Any valid chunk name or text
Default
[LANG]
removeChunk
Purpose
Name of chunks to be stripped from content separated by
commas
Options
Any valid chunkname that appears in the output
Default
[NULL]
hiddenFields
Purpose
Allow Ditto to retrieve fields its template parser cannot
handle such as nested placeholders and [fields]
Options
Any valid MODx fieldnames or TVs comma separated
Default
[NULL]
start
Purpose
Number of documents to skip in the results
Options
Any number
Default
14 of 22
0
globalFilterDelimiter
Purpose
Filter delimiter used to separate filters in the filter string
Options
Any character not used in the filters
Default
”|”
Related
localFilterDelimiter
filter
parseFilters
localFilterDelimiter
Purpose
Delimiter used to separate individual parameters within each
filter string
Options
Any character not used in the filter itself
Default
”,”
Related
globalFilterDelimiter
filter
parseFilters
filter
Purpose
Removes items not meeting a critera. Thus, if pagetitle ==
joe then it will be removed. Use in the format field,criteria,mode
with the comma being the local delimiter
Mode Meaning
15 of 22
1 !=
2 ==
3 <
4 >
5 <=
6 >=
7 Text not in field value
8 Text in field value
9 case insenstive version of #7
10 case insenstive version of #8
11 checks leading character of the field
@EVAL
@EVAL in filters works the same as it does in MODx exect it
can only be used with basic filtering, not custom filtering
(tagging, etc). Make sure that you return the value you wish
Ditto to filter by and that the code is valid PHP.
Default
[NULL]
Related
localFilterDelimiter
globalFilterDelimiter
parseFilters
keywords
Purpose
Enable fetching of associated keywords for each document
Can be used as [+keywords+] or as a tagData source
Options
0 off
1 on
Default
0 off
randomize
Purpose
Randomize the order of the output
16 of 22
Options
0 off
1 on Any MODx field or TV for weighted random
Default
0 off
save
Purpose
Saves the ditto object and results set to placeholders for use
by other snippets
Options
0 off; returns output
1 remaining; returns output
2 all;
3 all; returns ph only
Default
0 off; returns output
tpl
Purpose
User defined chunk to format the documents
Options
Any valid chunk name
Code via @CODE
File via @FILE
Default
[LANG]
tplAlt
Purpose
User defined chunk to format every other document
Options
Any valid chunk name
17 of 22
Code via @CODE
File via @FILE
Default
&tpl
tplFirst
Purpose
User defined chunk to format the first document
Options
Any valid chunk name
Code via @CODE
File via @FILE
Default
&tpl
tplLast
Purpose
User defined chunk to format the last document
Options
Any valid chunk name
Code via @CODE
File via @FILE
Default
&tpl
18 of 22
tplCurrentDocument
Purpose
User defined chunk to format the current document
Options
Any valid chunk name
Code via @CODE
File via @FILE
Default
&tpl
orderBy
Purpose
Sort the result set
Options
Any valid MySQL style orderBy statement
Default
createdon DESC
paginateAlwaysShowLinks
Purpose
Determine whether or not to always show previous next links
Options
0 off
1 on
Default
0 off
Related
paginate
paginateSplitterCharacter
paginateSplitterCharacter
19 of 22
Purpose
Splitter to use if always show is disabled
Options
Any valid character
Default
[LANG]
Related
paginate
paginateSplitterCharacter
tplPaginatePrevious
Purpose
Template for the previous link
Options
Any valid chunk name
Code via @CODE
File via @FILE
Placeholders
url URL for the previous link
lang:previous value of ‘prev’ from the language
file
Related
tplPaginateNext
paginateSplitterCharacter
tplPaginateNext
Purpose
Template for the next link
Options
Any valid chunk name
Code via @CODE
File via @FILE
Placeholders
url URL for the next link
lang:next value of ‘next’ from the language file
20 of 22
Related
tplPaginatePrevious
paginateSplitterCharacter
tplPaginateNextOff
Purpose
Template for the inside of the next link
Options
Any valid chunk name
Code via @CODE
File via @FILE
Placeholders
lang:next value of ‘next’ from the language file
Related
tplPaginatePrevious
paginateSplitterCharacter
tplPaginatePreviousOff
Purpose
Template for the previous link when it is off
Options
Any valid chunk name
Code via @CODE
File via @FILE
Placeholders
lang:previous value of ‘prev’ from the language
file
Related
tplPaginatePrevious
paginateSplitterCharacter
tplPaginatePage
Purpose
Template for the page link
Options
Any valid chunk name
21 of 22
Code via @CODE
File via @FILE
Placeholders
url url for the page
page number of the page
Related
tplPaginatePrevious
paginateSplitterCharacter
tplPaginateCurrentPage
Purpose
Template for the current page link
Options
Any valid chunk name
Code via @CODE
File via @FILE
Placeholders
page number of the page
Related
tplPaginatePrevious
paginateSplitterCharacter
item[x]
Content
Individual items rendered output
22 of 22
Welcome
Purpose
Snippet
The Ditto class contains all functions relating to Ditto’s
functionality and any supporting functions they need
Snippet
Summary
Wordpress Config
Main Class The Ditto class contains
all functions relating to
Ditto’s functionality and
Main Class
any supporting functions
Template Class they need
Functions
getTVList Get a list of all available TVs
addField Add a field to the internal field
detection system
addFields Add a field to the internal field
ATOM detection system from an
array or delimited string
JSON
removeField Remove a field to the internal
field detection system
XML setDisplayFields Move the detected fields into
the Ditto fields array
getDocVarType Determine if the provided
field is a tv, a database field,
or something else
parseOrderBy Parse out orderBy parameter
string
Summary
checkAdvSort Check the advSortString
Tagging parseFilters Split up the filters into an
array and add the required
fields to the fields array
render Render the document output
parseFields Find the fields that are
contained in the custom
placeholders or those that are
needed in other functions
arrayUnique Make fields array unique
parseCustomPlaceholders Parse the required fields out
of the custom placeholders
parseDBFields Parse out the fields required
for each state
renderQELinks Render QE links when needed
1 of 10
getAuthor Get the author name, or if not
available the username
customSort Sort resource array if
advanced sorting is needed
userSort Sort the resource array by a
user defined function
multiSort Sort the resource array by
multiple fields
Rows->Columns portion by
Jon L.
determineIDs Get Document IDs for future
use
weightedRandom Execute a random order sort
getParentList Get a list of all available
parents
appendTV Apeend a TV to the
documents array
appendKeywords Append keywords’s to the
resource array
fetchKeywords Helper function to
appendKeywords
getChildIDs Get the IDs ready to be
processed Similar to the
modx version by the same
name but much faster
getDocuments Get documents and append
TVs + Prefetch Data, and sort
getDocumentsLite Get an array of documents
cleanIDs Clean the IDs of any
dangerous characters
buildURL Build a URL with regard to
Ditto ID
getParam Get a parameter or use the
default language value
paginate Paginate the documents
noResults Render the noResults output
relToAbs Convert relative urls to
absolute URLs Based on script
from
http://wintermute.com.au
/bits/2005-09/php-relative-
absolute-links/
getTVList
2 of 10
function getTVList()
addField
function addField($name,
$location,
$type = false)
addFields
function addFields($fields,
$location = '*',
$delimiter = ',',
$callback = false)
removeField
function removeField($name,
$location,
$type )
setDisplayFields
function setDisplayFields($fields,
$hiddenFields)
3 of 10
getDocVarType
function getDocVarType($field)
parseOrderBy
function parseOrderBy($orderBy,
$randomize)
checkAdvSort
function checkAdvSort($sortBy,
$sortDir = 'asc')
parseFilters
render
function render($resource,
$template,
4 of 10
$removeChunk,
$dateSource,
$dateFormat,
$ph = array(),
$phx = 1,
$x = 0 )
parseFields
function parseFields($placeholders,
$seeThruUnpub,
$dateSource,
$randomize )
arrayUnique
function arrayUnique($array)
parseCustomPlaceholders
function parseCustomPlaceholders($placeholders)
parseDBFields
function parseDBFields($seeThruUnpub)
5 of 10
renderQELinks
function renderQELinks($fields,
$resource,
$QEPrefix,
$placeholders)
getAuthor
function getAuthor($createdby)
customSort
function customSort($data,
$fields,
$order )
userSort
function userSort($resource,
$sort )
multiSort
function multiSort($resource,
$orderBy )
6 of 10
Link: http://de3.php.net /manual /en /function.array-
multisort.php#73498
determineIDs
function determineIDs($IDs,
$IDType,
$TVs,
$orderBy,
$depth,
$showPublishedOnly,
$seeThruUnpub,
$hideFolders,
$hidePrivate,
$showInMenuOnly,
$myWhere,
$keywords,
$dateSource,
$limit,
$summarize,
$filter,
$paginate,
$randomize )
weightedRandom
function weightedRandom($resource,
$field,
$show )
getParentList
function getParentList()
appendTV
7 of 10
function appendTV($tvname = "",
$docIDs )
appendKeywords
function appendKeywords($resource)
fetchKeywords
function fetchKeywords($resource)
getChildIDs
function getChildIDs($IDs,
$depth)
getDocuments
8 of 10
$dateSource = false)
getDocumentsLite
cleanIDs
function cleanIDs($IDs)
buildURL
function buildURL($args,
$id = false,
$dittoIdentifier = false )
getParam
function getParam($param,
$langString)
paginate
function paginate($start,
$stop,
$total,
9 of 10
$summarize,
$tplPaginateNext,
$tplPaginatePrevious,
$tplPaginateNextOff,
$tplPaginatePreviousOff,
$tplPaginatePage,
$tplPaginateCurrentPage,
$paginateAlwaysShowLinks,
$paginateSplitterCharacter)
noResults
function noResults($text,
$paginate)
relToAbs
function relToAbs($text,
$base )
10 of 10
Template Class
Welcome
Purpose
Snippet
The Template class contains all functions relating to Ditto’s
handling of templates and any supporting functions they
need
Snippet
Summary
Wordpress Config
template
function template()
1 of 3
process
function process($template)
findTemplateVars
function findTemplateVars($tpl)
sortFields
replace
function replace($placeholders,
$tpl )
2 of 3
determine
function determine($templates,
$x,
$start,
$stop,
$id )
fetch
function fetch($tpl)
http://modxcms.com/forums/index.php/topic
,5344.msg41096.html#msg41096
get_file_contents
function get_file_contents($filename)
3 of 3
Welcome
Purpose
Snippet
The Filter class contains all functions relating to filtering, the
removing of documents from the result set
Snippet
Summary
Wordpress Config
Filter Class The Filter class contains all
functions relating to filtering,
the removing of documents
from the result set
Template Class
Functions
Filter Class
execute Filter documents via either a custom
filter or basic filter
basicFilter Do basic comparison filtering
ATOM
JSON
XML
execute
function execute($resource,
$filter )
basicFilter
Search
Do basic comparison filtering
1 of 1
Welcome
Purpose
Snippet
The Debug class contains all functions relating to Ditto’s
implimentation of the MODx debug console
Snippet
Summary
Wordpress Config
Debug Class The Debug class contains all
functions relating to Ditto’s
implimentation of the MODx
debug console
Template Class
Functions
render_link Render the links to the debug
Debug Class console
render_popup Render the contents of the debug
console
preparePrefetch Create the content of the Prefetch
ATOM tab
Summary
Tagging
render_link
function render_link($dittoID,
$ditto_base)
render_popup
1 of 3
function render_popup($ditto,
$ditto_base,
$ditto_version,
$ditto_params,
$IDs,
$fields,
$summarize,
$templates,
$orderBy,
$start,
$stop,
$total,
$filter,
$resource )
preparePrefetch
function preparePrefetch($prefetch)
prepareFilters
function prepareFilters($filter)
prepareDocumentInfo
function prepareDocumentInfo($resource)
prepareBasicInfo
function prepareBasicInfo($ditto,
$ditto_version,
2 of 3
$IDs,
$summarize,
$orderBy,
$start,
$stop,
$total )
prepareTemplates
function prepareTemplates($templates)
3 of 3
Welcome
Purpose
Snippet
A class designed to help developers impliment a debug
console like to the one in Ditto 2
Snippet
Summary
Wordpress Config
MODx Debug A class designed to help
Console developers impliment a debug
console like to the one in Ditto
2
Template Class
Functions
render Render the contents of the debug
console
MODx Debug Console save Save the debug console as a file
makelink Render the links to the debug console
buildURL Build a URL with regard to a prefix
ATOM
makeTab Render a tab
JSON
makeMODxSafe Make all MODx tags safe for the
output
XML makeParamTable Turn an array of parameters in the
format [“param”] => “value” into a
table
cleanArray Remove empty items from the array
array2table Translate a result array into a HTML
table
Summary
Tagging
render
function render($cTabs,
$title,
$base_path)
1 of 3
save
function save($html,
$filename)
makelink
buildURL
function buildURL($args,
$id = false,
$prefix = "" )
makeTab
function makeTab($title,
$content)
Render a tab
makeMODxSafe
function makeMODxSafe($value)
makeParamTable
2 of 3
function makeParamTable($parameters = array(),
$header = "",
$sort = true,
$prep = true,
$wordwrap = true )
cleanArray
function cleanArray($array)
array2table
function array2table($array,
$recursive = false,
$return = false,
$null = ' ')
Version: 1.3.1
Link: http://aidanlister.com/repos/v
/function.array2table.php
3 of 3
ATOM
Welcome
Purpose
Snippet
Collection of parameters, functions, and classes that expand
Ditto’s output capabilities to include ATOM
Summary
Template Class
ATOM Collection of parameters,
functions, and classes that
expand Ditto’s output
capabilities to include ATOM
Parameters
abbrLanguage Language for the Atom feed
ATOM charset Charset to use for the Atom feed
JSON
XML
abbrLanguage
Purpose
Summary Language for the Atom feed
Tagging
Options
Any valid 2 character language abbreviation
Compatibility
Default
[LANG]
Related
language
charset
Purpose
Charset to use for the Atom feed
Options
1 of 2
Any valid charset identifier
Default
MODx default charset
2 of 2
JSON
Welcome
Purpose
Snippet
Collection of parameters, functions, and classes that expand
Ditto’s output capabilities to include JSON
Summary
Template Class
JSON Collection of parameters,
functions, and classes that
expand Ditto’s output
capabilities to include JSON
Parameters
abbrLanguage Language for the JSON document
ATOM copyright Copyright message to embed in the
JSON JSON document
ttl Time to live for the JSON feed
XML
abbrLanguage
Summary
Purpose
Tagging
Language for the JSON document
Compatibility Options
Any valid 2 character language abbreviation
Default
[LANG]
Related
language
copyright
Purpose
Copyright message to embed in the JSON document
1 of 2
Options
Any text
Default
[LANG]
ttl
Purpose
Time to live for the JSON feed
Options
Any integer greater than 1
Default
120
2 of 2
Welcome
Purpose
Snippet
Collection of parameters, functions, and classes that expand
Ditto’s output capabilities to include RSS
Summary
Template Class
RSS Collection of parameters,
functions, and classes that
expand Ditto’s output
capabilities to include RSS
Parameters
copyright Copyright message to embed in the
ATOM RSS feed
Summary
Tagging
copyright
Compatibility
Purpose
Copyright message to embed in the RSS feed
Options
Any text
Default
[LANG]
abbrLanguage
Purpose
1 of 3
Language for the RSS feed
Options
Any valid 2 character language abbreviation
Default
[LANG]
Related
language
ttl
Purpose
Time to live for the RSS feed
Options
Any integer greater than 1
Default
120
charset
Purpose
Charset to use for the RSS feed
Options
Any valid charset identifier
Default
MODx default charset
xsl
Purpose
XSL Stylesheet to format the RSS feed with
Options
2 of 3
The path to any valid XSL Stylesheet
Default
None
3 of 3
XML
Welcome
Purpose
Snippet
Collection of parameters, functions, and classes that expand
Ditto’s output capabilities to include XML
Summary
Template Class
XML Collection of parameters,
functions, and classes that
expand Ditto’s output
capabilities to include XML
Parameters
copyright Copyright message to embed in the
ATOM XML feed
Summary
Tagging
copyright
Compatibility
Purpose
Copyright message to embed in the XML feed
Options
Any text
Default
[LANG]
abbrLanguage
Purpose
1 of 3
Language for the XML feed
Options
Any valid 2 character language abbreviation
Default
[LANG]
Related
language
ttl
Purpose
Time to live for the RSS feed
Options
Any integer greater than 1
Default
120
charset
Purpose
Charset to use for the RSS feed
Options
Any valid charset identifier
Default
MODx default charset
xsl
Purpose
XSL Stylesheet to format the XML feed with
Options
2 of 3
The path to any valid XSL Stylesheet
Default
None
3 of 3
Welcome
Purpose
Snippet
Filtering companion to Reflect or other date based filtering
Summary
Italian
dateFilterSource
Purpose
Source for the day, month, and year to filter by
Options
get gets the value of year, month, and
day from the URL (pre-appended with
the Ditto ID)
params gets the value from the snippet cal
text name of the request variable to use
Default
1 of 4
get
dateSource
Purpose
Source of the [+date+] placeholder
Options
# Any UNIX timestamp from MODx fields or
TVs such as createdon, pub_date, or
editedon
Default
”createdon”
Related
dateFormat
dateFilterDefault
Purpose
Determine the default filter
Options
0 filter off
1 current year
2 current year and month
3 current year, month, and day
Default
0
month
Purpose
Month to filter by
Options
# Number between 1-12 (inclusive) that
2 of 4
corresponds to the month to filter by
Default
[NULL]
year
Purpose
Year to filter by
Options
# Any numerical year (4 numbers; ex: 2006)
Default
[NULL]
day
Purpose
Day to filter by
Options
# Any numerical day within the current
month
Default
[NULL]
year
Content
Year being filtered by
month
3 of 4
Content
Month being filtered by
month
Content
Numeric version of the month being filtered by
day
Content
Day being filtered by
4 of 4
Welcome
Purpose
Snippet
Example file for basing new Extenders on
Summary
1 of 3
9239423942 and the mode 2
param
Purpose
The purpose of your parameter goes here
Options
Any options that your parameter can have go here
Default
”default”
$placeholders[‘example’]
2 of 3
exampleFunction
function exampleFunction($resource)
$filters[“custom”][“exampleFilter”]
exampleFilter
function exampleFilter($resource)
$filters[“parsed”][]
Add the pre-parsed filter to the parsed filters list with the
source as id, the value of 9239423942 and the mode 2
3 of 3
Welcome
Purpose
Snippet
Adds support for changing Ditto parameters via URL
Note
All variables must be prefixed with ditto_ for the snippet to recognize them!
If a Ditto id is set use the sntax
ATOM
Summary
JSON
Summary
Tagging
Compatibility
stripTags
Purpose
Remove HTML tags from the parameters provided
Italian
Options
0 off
1 on
Default
1 on
bad
Purpose
Parameters that are not allowed to be set
Options
Any valid Ditto options separated by commas
Default
”seeThroughtUnpub,showInMenuOnly,showPublishedOnly,debug,start,config,extenders,dittoID”
good
Purpose
Parameters that are allowed to be set
1 of 2
Options
Any valid Ditto options separated by commas
Default
All parameters execpt those in &bad
dbg
Purpose
Output variables being set
Options
0 off
1 on
Default
0 off
2 of 2
Welcome
Purpose
Snippet
Legacy support for the [+summary+] placeholder
Summary
Compatibility
trunc
Italian Purpose
Enable truncation on the summary placeholder
Options
0 off
1 on
Default
1 on
truncAt
Purpose
Location to split the content at
1 of 3
Options
Any unique text or code string that is contained in the
content of each document
Default
”<!-- splitter -->”
truncLen
Purpose
Number of characters to show of the content
Options
Any number greater than truncOffset
Default
300
truncOffset
Purpose
Number of charactars to “wander” either way of truncLen
Options
Any number greater less than truncLen
Default
30
truncText
Purpose
Text to be displayed in [+link+]
Options
Any valid text or html
Default
2 of 3
”Read more...”
tplTrunc
Purpose
Template to be used for [+link+]
Options
Any valid chunk name
Code via @CODE:
File via @FILE:
Placeholders
[+url+] URL of the document
[+text+] &truncText
Default
&truncText
3 of 3
Tagging
Welcome
Purpose
Snippet
Collection of parameters, functions, and classes that expand
Ditto’s functionality to include tagging
Summary
Placeholders
tagLinks Nice ‘n beautiful tag list with links
pointing to tagDocumentID
tags Raw tags separated by tagDelimiter
tagDocumentID
1 of 6
Purpose
ID for tag links to point to
Options
Any MODx document with a Ditto call setup to receive
the tags
Default
Current MODx Document
tagData
Purpose
Field to get the tags from
Options
Comma separated list of MODx fields or TVs
Default
[NULL]
caseSensitive
Purpose
Determine whether or not tag matching and duplicate tag
removal are case sensitive
Options
0 off
1 on
Default
0 off
tagMode
Purpose
Filtering method to remove tags
2 of 6
Options
onlyAllTags show documents that have all
of the tags
onlyTags show documents that have
any of the tags
removeAllTags remove documents that have
all of the tags
removeTags documents that have any of
the tags
Default
”onlyTags”
tagDelimiter
Purpose
Delimiter that splits each tag in the tagData source
Options
Any character not included in the tags themselves
Default
” “ space
tagDisplayDelimiter
Purpose
What separates the tags in [+tagLinks+]
Options
Any character
Default
&tagDelimiter
tagSort
Purpose
Sort the tags alphanumerically
3 of 6
Options
0 off
1 on
Default
1 on
tagDisplayMode
Purpose
How to display the tags in [+tagLinks+]
Options
1 string of links &tagDisplayDelimiter
separated
2 ul/li list
Note
Output of individual items can be customized by
tplTagLinks
Default
1 string of links &tagDisplayDelimiter
separated
tags
Purpose
Allow the user to provide initial tags to be filtered
Options
Any valid tags separated by tagDelimiter
Default
[NULL]
tplTagLinks
Purpose
Define a custom template for the tagLinks placeholder
4 of 6
Options
Any valid chunk name
Code via @CODE
File via @FILE
Default
<a href="[+url+]" class="ditto_tag" rel="tag">[+tag+]</a>
tagCallback
Purpose
Allow the user to modify both where the tags come from
and how they are parsed.
Options
Any valid function name
Default
[NULL]
Notes
The function should expect to receive the following three
parameters: tagData - the provided source of the tags
resource - the resource array for the document being parsed
array - return the results in an array if true
tagLinks
Content
Nice ‘n beautiful tag list with links pointing to
tagDocumentID
tags
Content
Raw tags separated by tagDelimiter
5 of 6
Generated by Natural Docs
6 of 6
Welcome
Purpose
Snippet
Default templates for Reflect
Snippet Summary
Default Templates
Wordpress Config Default Default templates for Reflect
Templates
Variables
$defaultTemplates Holds the default templates
Template Class
Variables
$defaultTemplates
ATOM
JSON $defaultTemplates
Summary
Tagging
Search
1 of 1
Welcome
Description
Snippet
Generates date based archives using Ditto
Snippet Author
Mark Kaplan for MODx CMF
Wordpress Config
Version
2.1.0
Template Class
Note
If Reflect is not retrieving its own documents, make sure that
the Ditto call feeding it has all of the fields in it that you plan
on calling in your Reflect template. Furthermore, Reflect will
ONLY show what is currently in the Ditto result set. Thus, if
pagination is on it will ONLY show that page’s items.
ATOM
JSON Summary
1 of 9
params Pass parameters to the Ditto instance
used to retreive the documents
source Name of the Ditto snippet to use
tplContainer Container template for the archive
tplYear Template for the year item
tplYearInner Template for the year item (the ul to
hold the year template)
tplMonth Template for the month item
tplMonthInner Template for the month item (the ul
to hold the month template)
tplItem Template for the individual item
ditto_base
Purpose
Location of Ditto files
Options
Any valid folder location containing the Ditto source code
with a trailing slash
Default
[(base_path)]assets/snippets/ditto/
config
Purpose
Load a custom configuration
Options
”default” default blank config file
CONFIG_NAME Other configs installed in the
configs folder or in any folder
within the MODx base path via
@FILE
Default
”default”
Related
2 of 9
extenders
id
Purpose
Unique ID for this Ditto instance for connection with
other scripts (like Reflect) and unique URL parameters
Options
Any valid folder location containing the Ditto source code
with a trailing slash
Default
”” blank
getDocuments
Purpose
Force Reflect to get documents
Options
0 off
1 on
Default
0 off
showItems
Purpose
Show individual items in the archive
Options
0 off
1 on
Default
1 on
3 of 9
groupByYears
Purpose
Group the archive by years
Options
0 off
1 on
Default
1 on
targetID
Purpose
ID for archive links to point to
Options
Any MODx document with a Ditto call setup with
extenders=`dateFilter`
Default
Current MODx Document
dateSource
Purpose
Date source to display for archive items
Options
# Any UNIX timestamp from MODx fields or
TVs such as createdon, pub_date, or
editedon
Default
”createdon”
Related
dateFormat
4 of 9
dateFormat
Purpose
Format the [+date+] placeholder in human readable
form
Options
Any PHP valid strftime option
Default
”%d-%b-%y %H:%M”
Related
dateSource
yearSortDir
Purpose
Direction to sort documents
Options
ASC ascending
DESC descending
Default
”DESC”
Related
monthSortDir
monthSortDir
Purpose
Direction to sort the months
Options
ASC ascending
DESC descending
Default
”ASC”
5 of 9
Related
yearSortDir
start
Purpose
Number of documents to skip in the results
Options
Any number
Default
0
phx
Purpose
Use PHx formatting
Options
0 off
1 on
Default
1 on
params
Purpose
Pass parameters to the Ditto instance used to retreive
the documents
Options
Any valid ditto parameters in the format name:value
with multiple parameters separated by a pipe (|)
Note
This parameter is only needed for config, start, and phx
as you can now simply use the parameter as if Reflect was
Ditto
6 of 9
Default
[NULL]
source
Purpose
Name of the Ditto snippet to use
Options
Any valid snippet name
Default
”Ditto”
tplContainer
Purpose
Container template for the archive
Options
Any valid chunk name
Code via @CODE:
File via @FILE:
Default
See default.tempates.php
7 of 9
tplYear
Purpose
Template for the year item
Options
Any valid chunk name
Code via @CODE:
File via @FILE:
Default
See default.tempates.php
tplYearInner
Purpose
Template for the year item (the ul to hold the year
template)
Options
Any valid chunk name
Code via @CODE:
File via @FILE:
Default
See default.tempates.php
tplMonth
Purpose
Template for the month item
Options
Any valid chunk name
Code via @CODE:
File via @FILE:
Default
See default.tempates.php
8 of 9
tplMonthInner
Purpose
Template for the month item (the ul to hold the month
template)
Options
Any valid chunk name
Code via @CODE:
File via @FILE:
Default
See default.tempates.php
tplItem
Purpose
Template for the individual item
Options
Any valid chunk name
Code via @CODE:
File via @FILE:
Default
See default.tempates.php
9 of 9
Template Class
Welcome
Purpose
Snippet
The Template class contains all functions relating to Ditto’s
handling of templates and any supporting functions they
need
Snippet
Summary
Wordpress Config
template
function template()
1 of 3
process
function process($template)
findTemplateVars
function findTemplateVars($tpl)
sortFields
replace
function replace($placeholders,
$tpl )
2 of 3
determine
function determine($templates,
$x,
$start,
$stop,
$id )
fetch
function fetch($tpl)
http://modxcms.com/forums/index.php/topic
,5344.msg41096.html#msg41096
get_file_contents
function get_file_contents($filename)
3 of 3