Description Aggregates documents to create blogs, article/news collections, and more,with full support for templating. Author Mark Kaplan for MODx CMF Version 2.1.0 Summary Ditto Snippet Aggregates documents to create blogs, article/news collections, and more,with full support for templating. Parameters ditto_base Location of Ditto files id Unique ID for this Ditto instance for connection with other scripts (like Reflect) and unique URL parameters language language for defaults, debug, and error messages format Output format to use config Load a custom configuration debug Output debugging information phx Use PHx formatting extenders Load an extender which adds functionality to Ditto 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 Welcome Snippet Snippet Wordpress Config Template Class ATOM JSON XML Summary Tagging 1 of 22
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Description
Aggregates documents to create blogs, article/news collections,and more,with full support for templating.
Author
Mark Kaplan for MODx CMF
Version
2.1.0
Summary
Ditto Snippet Aggregates documents tocreate blogs, article/newscollections, and more,withfull support for templating.
Parameters
ditto_base Location of Ditto files
id Unique ID for this Ditto instancefor connection with other scripts(like Reflect) and unique URLparameters
language language for defaults, debug, anderror messages
format Output format to use
config Load a custom configuration
debug Output debugging information
phx Use PHx formatting
extenders Load an extender which addsfunctionality to Ditto
Variables
extenders Array that can be added to byconfigs or formats to load thatextender
placeholders Initialize custom placeholdersarray for configs or extenders toadd to
filters Holds both the custom filters arrayfor configs or extenders to add toand the parsed filters array.
orderBy An array that holds all criteria tosort the result set by.
idType type of IDs provided; can be eitherparents or documents
Welcome
Snippet
Snippet
Wordpress Config
Template Class
ATOM
JSON
XML
Summary
Tagging
1 of 22
Parameters
parents IDs of containers for Ditto toretrieve their children to &depthdepth
documents IDs of documents for Ditto toretrieve
Variables
IDs Internal variable which holds theset of IDs for Ditto to fetch
Parameters
depth Number of levels deep to retrievedocuments
paginate Paginate the results set into pagesof &display length.
dateSource Source of the [+date+]placeholder
dateFormat Format the [+date+] placeholderin human readable form
display Number of documents to display inthe results
total Number of documents to retrieve
showPublishedOnly Show only published documents
showInMenuOnly Show only documents visible in themenu
hideFolders Don’t show folders in the returnedresults
hidePrivate Don’t show documents the guestor user does not have permissionto see
seeThruUnpub See through unpublished folders toretrive their children Used whendepth is greater than 1
queryLimit Number of documents to retrievefrom the database, same asMySQL LIMIT
where Custom MySQL WHERE statement
noResults Text or chunk to display whenthere are no results
removeChunk Name of chunks to be strippedfrom content separated bycommas
hiddenFields Allow Ditto to retrieve fields itstemplate parser cannot handlesuch as nested placeholders and[fields]
start Number of documents to skip inthe results
globalFilterDelimiter Filter delimiter used to separatefilters in the filter string
localFilterDelimiter Delimiter used to separateindividual parameters within eachfilter string
2 of 22
filter Removes items not meeting acritera.
keywords Enable fetching of associatedkeywords for each document Canbe used as [+keywords+] or as atagData source
randomize Randomize the order of the output
save Saves the ditto object and resultsset to placeholders for use byother snippets
tpl User defined chunk to format thedocuments
tplAlt User defined chunk to formatevery other document
tplFirst User defined chunk to format thefirst document
tplLast User defined chunk to format thelast document
tplCurrentDocument User defined chunk to format thecurrent document
orderBy Sort the result set
paginateAlwaysShowLinks Determine whether or not toalways show previous next links
paginateSplitterCharacter Splitter to use if always show isdisabled
tplPaginatePrevious Template for the previous link
tplPaginateNext Template for the next link
tplPaginateNextOff Template for the inside of the nextlink
tplPaginatePreviousOff Template for the previous linkwhen 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 witha trailing slash
Default
3 of 22
[(base_path)]assets/snippets/ditto/
id
Purpose
Unique ID for this Ditto instance for connection with otherscripts (like Reflect) and unique URL parameters
Options
Any combination of characters a-z, underscores, and numbers0-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 configsfolder or in any folder within theMODx 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 withinthe MODx base path via @FILE
Default
[NULL]
Related
config
Variables
extenders
Array that can be added to by configs or formats to load thatextender
placeholders
Initialize custom placeholders array for configs or extendersto add to
filters
Holds both the custom filters array for configs or extenders toadd to and the parsed filters array. To add to this array, use thefollowing format
# Any UNIX timestamp from MODx fields or TVssuch 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
queryLimittotal
total
Purpose
Number of documents to retrieve
Options
# Any number
”all” All documents found
Default
”all” All documents found
Related
displayqueryLimit
showPublishedOnly
Purpose
Show only published documents
Options
0 show only unpublished documents
10 of 22
1 show both published and unpublisheddocuments
Default
1 show only published documents
Related
seeThruUnpubhideFoldersshowPublishedOnlywhere
showInMenuOnly
Purpose
Show only documents visible in the menu
Options
0 show all documents
1 show only documents with the show in menuflag checked
Default
0 show all documents
Related
seeThruUnpubhideFolderswhere
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
seeThruUnpubshowInMenuOnlywhere
hidePrivate
Purpose
Don’t show documents the guest or user does not havepermission to see
Options
0 show private documents
1 hide private documents
Default
1 hide private documents
Related
seeThruUnpubshowInMenuOnlywhere
seeThruUnpub
Purpose
See through unpublished folders to retrive their children Usedwhen depth is greater than 1
Options
0 off
1 on
12 of 22
Default
0 off
Related
hideFoldersshowInMenuOnlywhere
queryLimit
Purpose
Number of documents to retrieve from the database, same asMySQL 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 objectitems (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 bycommas
Commonly used to remove comments
Options
Any valid chunkname that appears in the output
Default
[NULL]
hiddenFields
Purpose
Allow Ditto to retrieve fields its template parser cannothandle 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
localFilterDelimiterfilterparseFilters
localFilterDelimiter
Purpose
Delimiter used to separate individual parameters within eachfilter string
Options
Any character not used in the filter itself
Default
”,”
Related
globalFilterDelimiterfilterparseFilters
filter
Purpose
Removes items not meeting a critera. Thus, if pagetitle ==joe then it will be removed. Use in the format field,criteria,modewith 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 itcan only be used with basic filtering, not custom filtering(tagging, etc). Make sure that you return the value you wishDitto to filter by and that the code is valid PHP.
function determineIDs($IDs,$IDType,$TVs,$orderBy,$depth,$showPublishedOnly,$seeThruUnpub,$hideFolders,$hidePrivate,$showInMenuOnly,$myWhere,$keywords,$dateSource,$limit,$summarize,$filter,$paginate,$randomize )
Get Document IDs for future use
weightedRandom
function weightedRandom($resource,$field,$show )
Execute a random order sort
getParentList
function getParentList()
Get a list of all available parents
appendTV
7 of 10
function appendTV($tvname = "",$docIDs )
Apeend a TV to the documents array
appendKeywords
function appendKeywords($resource)
Append keywords’s to the resource array
fetchKeywords
function fetchKeywords($resource)
Helper function to appendKeywords
getChildIDs
function getChildIDs($IDs,$depth)
Get the IDs ready to be processed Similar to the modxversion by the same name but much faster
From http://www.nutt.net/2006/07/08/file_get_contents-function-for-php-4/#more-210
Generated by Natural Docs
3 of 3
Purpose
The Filter class contains all functions relating to filtering, theremoving of documents from the result set
Summary
Filter Class The Filter class contains allfunctions relating to filtering,the removing of documentsfrom the result set
Functions
execute Filter documents via either a customfilter or basic filter
basicFilter Do basic comparison filtering
execute
function execute($resource,$filter )
Filter documents via either a custom filter or basic filter
basicFilter
function basicFilter ($value)
Do basic comparison filtering
Generated by Natural Docs
Welcome
Snippet
Snippet
Wordpress Config
Template Class
Filter Class
ATOM
JSON
XML
Summary
Tagging
Search
1 of 1
Purpose
The Debug class contains all functions relating to Ditto’simplimentation of the MODx debug console
Summary
Debug Class The Debug class contains allfunctions relating to Ditto’simplimentation of the MODxdebug console
Functions
render_link Render the links to the debugconsole
render_popup Render the contents of the debugconsole
preparePrefetch Create the content of the Prefetchtab
prepareFilters Create the content of the Filterstab
prepareDocumentInfo Create the output for theDocument Info tab
prepareBasicInfo Create the outut for the Info ta
prepareTemplates Create the output for theTemplates tab
render_link
function render_link($dittoID,$ditto_base)
Render the links to the debug console
render_popup
Welcome
Snippet
Snippet
Wordpress Config
Template Class
Debug Class
ATOM
JSON
XML
Summary
Tagging
1 of 3
function render_popup($ditto,$ditto_base,$ditto_version,$ditto_params,$IDs,$fields,$summarize,$templates,$orderBy,$start,$stop,$total,$filter,$resource )
Render the contents of the debug console
preparePrefetch
function preparePrefetch($prefetch)
Create the content of the Prefetch tab
prepareFilters
function prepareFilters($filter)
Create the content of the Filters tab
prepareDocumentInfo
function prepareDocumentInfo($resource)
Create the output for the Document Info tab
prepareBasicInfo
function prepareBasicInfo($ditto,$ditto_version,
2 of 3
$IDs,$summarize,$orderBy,$start,$stop,$total )
Create the outut for the Info ta
prepareTemplates
function prepareTemplates($templates)
Create the output for the Templates tab
Generated by Natural Docs
3 of 3
Purpose
A class designed to help developers impliment a debugconsole like to the one in Ditto 2
Summary
MODx DebugConsole
A class designed to helpdevelopers impliment a debugconsole like to the one in Ditto2
Functions
render Render the contents of the debugconsole
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
makeTab Render a tab
makeMODxSafe Make all MODx tags safe for theoutput
makeParamTable Turn an array of parameters in theformat [“param”] => “value” into atable
cleanArray Remove empty items from the array
array2table Translate a result array into a HTMLtable
render
function render($cTabs,$title,$base_path)
Render the contents of the debug console
Welcome
Snippet
Snippet
Wordpress Config
Template Class
MODx Debug Console
ATOM
JSON
XML
Summary
Tagging
1 of 3
save
function save($html,$filename)
Save the debug console as a file
makelink
Render the links to the debug console
buildURL
function buildURL($args, $id = false,$prefix = "" )
Collection of parameters, functions, and classes that expandDitto’s output capabilities to include ATOM
Summary
ATOM Collection of parameters,functions, and classes thatexpand Ditto’s outputcapabilities to include ATOM
Parameters
abbrLanguage Language for the Atom feed
charset Charset to use for the Atom feed
abbrLanguage
Purpose
Language for the Atom feed
Options
Any valid 2 character language abbreviation
Default
[LANG]
Related
language
charset
Purpose
Charset to use for the Atom feed
Options
Welcome
Snippet
Template Class
ATOM
JSON
XML
Summary
Tagging
Compatibility
1 of 2
Any valid charset identifier
Default
MODx default charset
Generated by Natural Docs
2 of 2
JSON
Purpose
Collection of parameters, functions, and classes that expandDitto’s output capabilities to include JSON
Summary
JSON Collection of parameters,functions, and classes thatexpand Ditto’s outputcapabilities to include JSON
Parameters
abbrLanguage Language for the JSON document
copyright Copyright message to embed in theJSON document
ttl Time to live for the JSON feed
abbrLanguage
Purpose
Language for the JSON document
Options
Any valid 2 character language abbreviation
Default
[LANG]
Related
language
copyright
Purpose
Copyright message to embed in the JSON document
Welcome
Snippet
Template Class
ATOM
JSON
XML
Summary
Tagging
Compatibility
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
Generated by Natural Docs
2 of 2
Purpose
Collection of parameters, functions, and classes that expandDitto’s output capabilities to include RSS
Summary
RSS Collection of parameters,functions, and classes thatexpand Ditto’s outputcapabilities to include RSS
Parameters
copyright Copyright message to embed in theRSS feed
abbrLanguage Language for the RSS feed
ttl Time to live for the RSS feed
charset Charset to use for the RSS feed
xsl XSL Stylesheet to format the RSSfeed with
copyright
Purpose
Copyright message to embed in the RSS feed
Options
Any text
Default
[LANG]
abbrLanguage
Purpose
Welcome
Snippet
Template Class
ATOM
JSON
RSS
XML
Summary
Tagging
Compatibility
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
Generated by Natural Docs
3 of 3
XML
Purpose
Collection of parameters, functions, and classes that expandDitto’s output capabilities to include XML
Summary
XML Collection of parameters,functions, and classes thatexpand Ditto’s outputcapabilities to include XML
Parameters
copyright Copyright message to embed in theXML feed
abbrLanguage Language for the XML feed
ttl Time to live for the RSS feed
charset Charset to use for the RSS feed
xsl XSL Stylesheet to format the XMLfeed with
copyright
Purpose
Copyright message to embed in the XML feed
Options
Any text
Default
[LANG]
abbrLanguage
Purpose
Welcome
Snippet
Template Class
ATOM
JSON
XML
Summary
Tagging
Compatibility
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
Generated by Natural Docs
3 of 3
Purpose
Filtering companion to Reflect or other date based filtering
Summary
Date Filter Filtering companion to Reflector other date based filtering
Parameters
dateFilterSource Source for the day, month, and yearto filter by
dateSource Source of the [+date+] placeholder
dateFilterDefault Determine the default filter
month Month to filter by
year Year to filter by
day Day to filter by
Placeholders
year Year being filtered by
month Month being filtered by
month Numeric version of the month beingfiltered by
day Day being filtered by
dateFilterSource
Purpose
Source for the day, month, and year to filter by
Options
get gets the value of year, month, andday from the URL (pre-appended withthe Ditto ID)
params gets the value from the snippet cal
text name of the request variable to use
Default
Welcome
Snippet
ATOM
JSON
XML
Date Filter
Summary
Tagging
Compatibility
Italian
1 of 4
get
dateSource
Purpose
Source of the [+date+] placeholder
Options
# Any UNIX timestamp from MODx fields orTVs such as createdon, pub_date, oreditedon
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 currentmonth
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
Generated by Natural Docs
4 of 4
Purpose
Example file for basing new Extenders on
Summary
Example Example file for basingnew Extenders on
Parameters Define any parametersneeded in the extender orto override Ditto defaults
param The purpose of yourparameter goes here
Placeholders Defin the values ofcustom placeholders foraccess in the tpl like so[+phname+]
$placeholders[‘example’] Add the placeholder exampleto the custom placeholders listwith the source pagetitle inboth display and backendusing the exampleFunctioncallback and pagetitle as thefield for QuickEdit.
exampleFunction Takes the resource array foran individual document andreturns the value of theplaceholder, in this case theuppercase version of thepagetitle
Filters Define custom or basicfilters within the extenderto expand Ditto’s filteringcapabilities
$filters[“custom”][“exampleFilter”]
Add the filter exampleFilter tothe custom filters list with thesource pagetitle and thecallback exampleFilter
exampleFilter Takes the resource array foran individual document andasks for the return of a 0 or 1with 1 removing the documentand 0 leaving it in the resultset.
$filters[“parsed”][] Add the pre-parsed filter tothe parsed filters list with thesource as id, the value of
Welcome
Snippet
ATOM
JSON
XML
Example
Summary
Tagging
Compatibility
Italian
1 of 3
9239423942 and the mode 2
Define any parameters needed in the extender or tooverride Ditto defaults
param
Purpose
The purpose of your parameter goes here
Options
Any options that your parameter can have go here
Default
”default”
Defin the values of custom placeholders for access in thetpl like so [+phname+]
$placeholders[‘example’]
Add the placeholder example to the custom placeholderslist with the source pagetitle in both display and backendusing the exampleFunction callback and pagetitle as the fieldfor QuickEdit. If you only needed the placeholder in thefrontent you would just use “pagetitle” as the first value ofthe array. If the callback was in a class use thearray($initialized_class,”member”) method.
2 of 3
exampleFunction
function exampleFunction($resource)
Takes the resource array for an individual document andreturns the value of the placeholder, in this case theuppercase version of the pagetitle
Define custom or basic filters within the extender toexpand Ditto’s filtering capabilities
$filters[“custom”][“exampleFilter”]
Add the filter exampleFilter to the custom filters list withthe source pagetitle and the callback exampleFilter
exampleFilter
function exampleFilter($resource)
Takes the resource array for an individual document andasks for the return of a 0 or 1 with 1 removing the documentand 0 leaving it in the result set. In this case, if the lowercase value of the pagetitle is foo, it is removed while allother documents are shown
$filters[“parsed”][]
Add the pre-parsed filter to the parsed filters list with thesource as id, the value of 9239423942 and the mode 2
Generated by Natural Docs
3 of 3
Purpose
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
Summary
Request Adds support for changing Ditto parameters via URL
Parameters
stripTags Remove HTML tags from the parameters provided
Allow the user to modify both where the tags come fromand how they are parsed.
Options
Any valid function name
Default
[NULL]
Notes
The function should expect to receive the following threeparameters: tagData - the provided source of the tagsresource - the resource array for the document being parsedarray - return the results in an array if true
tagLinks
Content
Nice ‘n beautiful tag list with links pointing totagDocumentID
tags
Content
Raw tags separated by tagDelimiter
5 of 6
Generated by Natural Docs
6 of 6
Purpose
Default templates for Reflect
Summary
DefaultTemplates
Default templates for Reflect
Variables
$defaultTemplates Holds the default templates
Variables
$defaultTemplates
$defaultTemplates
Holds the default templates
Generated by Natural Docs
Welcome
Snippet
Snippet
Default Templates
Wordpress Config
Template Class
ATOM
JSON
XML
Summary
Tagging
Search
1 of 1
Description
Generates date based archives using Ditto
Author
Mark Kaplan for MODx CMF
Version
2.1.0
Note
If Reflect is not retrieving its own documents, make sure thatthe Ditto call feeding it has all of the fields in it that you planon calling in your Reflect template. Furthermore, Reflect willONLY show what is currently in the Ditto result set. Thus, ifpagination is on it will ONLY show that page’s items.
Summary
Reflect Snippet Generates date based archivesusing Ditto
Parameters
ditto_base Location of Ditto files
config Load a custom configuration
id Unique ID for this Ditto instance forconnection with other scripts (likeReflect) and unique URL parameters
getDocuments Force Reflect to get documents
showItems Show individual items in the archive
groupByYears Group the archive by years
targetID ID for archive links to point to
dateSource Date source to display for archiveitems
dateFormat Format the [+date+] placeholder inhuman readable form
yearSortDir Direction to sort documents
monthSortDir Direction to sort the months
start Number of documents to skip in theresults
phx Use PHx formatting
Welcome
Snippet
Snippet
Wordpress Config
Template Class
ATOM
JSON
XML
Summary
Tagging
1 of 9
params Pass parameters to the Ditto instanceused 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 tohold the year template)
tplMonth Template for the month item
tplMonthInner Template for the month item (the ulto 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 codewith 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 theconfigs folder or in any folderwithin the MODx base path via@FILE
Default
”default”
Related
2 of 9
extenders
id
Purpose
Unique ID for this Ditto instance for connection withother scripts (like Reflect) and unique URL parameters
Options
Any valid folder location containing the Ditto source codewith 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 withextenders=`dateFilter`
Default
Current MODx Document
dateSource
Purpose
Date source to display for archive items
Options
# Any UNIX timestamp from MODx fields orTVs such as createdon, pub_date, oreditedon
Default
”createdon”
Related
dateFormat
4 of 9
dateFormat
Purpose
Format the [+date+] placeholder in human readableform
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 retreivethe documents
Options
Any valid ditto parameters in the format name:valuewith multiple parameters separated by a pipe (|)
Note
This parameter is only needed for config, start, and phxas you can now simply use the parameter as if Reflect wasDitto
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 nameCode via @CODE:File via @FILE:
Default
See default.tempates.php
7 of 9
tplYear
Purpose
Template for the year item
Options
Any valid chunk nameCode via @CODE:File via @FILE:
Default
See default.tempates.php
tplYearInner
Purpose
Template for the year item (the ul to hold the yeartemplate)
Options
Any valid chunk nameCode via @CODE:File via @FILE:
Default
See default.tempates.php
tplMonth
Purpose
Template for the month item
Options
Any valid chunk nameCode 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 monthtemplate)
Options
Any valid chunk nameCode via @CODE:File via @FILE:
Default
See default.tempates.php
tplItem
Purpose
Template for the individual item
Options
Any valid chunk nameCode via @CODE:File via @FILE:
Default
See default.tempates.php
Generated by Natural Docs
9 of 9
Template Class
Purpose
The Template class contains all functions relating to Ditto’shandling of templates and any supporting functions theyneed
Summary
Template Class The Template class contains allfunctions relating to Ditto’shandling of templates and anysupporting functions they need
Functions
template Set the class language and fieldsvariables
process Take the templates and parse themfor tempalte variables, Check tomake sure they have fields, and sortthe fields
findTemplateVars Find al the template variables in thetemplate
sortFields Sort the array of fields provided bytype
replace Replcae placeholders with theirvalues
determine Determine the correct template toapply
fetch Get a template, based on version byDoze
get_file_contents Returns the contents of file namepassed
template
function template()
Set the class language and fields variables
Welcome
Snippet
Snippet
Wordpress Config
Template Class
ATOM
JSON
XML
Summary
Tagging
1 of 3
process
function process($template)
Take the templates and parse them for tempaltevariables, Check to make sure they have fields, and sort thefields
findTemplateVars
function findTemplateVars($tpl)
Find al the template variables in the template
sortFields
function sortFields ($fieldList)
Sort the array of fields provided by type
replace
function replace($placeholders,$tpl )
Replcae placeholders with their values
2 of 3
determine
function determine($templates,$x,$start,$stop,$id )