Reflect Snippet

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 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.

Summary
Reflect SnippetGenerates date based archives using Ditto
Parameters
ditto_baseLocation of Ditto files
configLoad a custom configuration
idUnique ID for this Ditto instance for connection with other scripts (like Reflect) and unique URL parameters
getDocumentsForce Reflect to get documents
showItemsShow individual items in the archive
groupByYearsGroup the archive by years
targetIDID for archive links to point to
dateSourceDate source to display for archive items
dateFormatFormat the [+date+] placeholder in human readable form
yearSortDirDirection to sort documents
monthSortDirDirection to sort the months
startNumber of documents to skip in the results
phxUse PHx formatting
paramsPass parameters to the Ditto instance used to retreive the documents
sourceName of the Ditto snippet to use
tplContainerContainer template for the archive
tplYearTemplate for the year item
tplYearInnerTemplate for the year item (the ul to hold the year template)
tplMonthTemplate for the month item
tplMonthInnerTemplate for the month item (the ul to hold the month template)
tplItemTemplate for the individual item

Parameters

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_NAMEOther configs installed in the configs folder or in any folder within the MODx base path via @FILE

Default

”default”

Related

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

0off
1on

Default

0off

showItems

Purpose

Show individual items in the archive

Options

0off
1on

Default

1on

groupByYears

Purpose

Group the archive by years

Options

0off
1on

Default

1on

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

Purpose

Format the [+date+] placeholder in human readable form

Options

Any PHP valid strftime option

Default

”%d-%b-%y %H:%M”

Related

yearSortDir

Purpose

Direction to sort documents

Options

ASCascending
DESCdescending

Default

”DESC”

Related

monthSortDir

Purpose

Direction to sort the months

Options

ASCascending
DESCdescending

Default

”ASC”

Related

start

Purpose

Number of documents to skip in the results

Options

Any number

Default

0

phx

Purpose

Use PHx formatting

Options

0off
1on

Default

1on

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

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

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

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

Load an extender which adds functionality to Ditto
Format the [+date+] placeholder in human readable form
Date source to display for archive items
Direction to sort the months
Direction to sort documents