Ditto 1.0.2
This version has been deprecated. See Ditto 2.
Features
- Tagging via the new commands tags, tagMode, tagData, and tagDelimiter
- Implemented via a basic external class architecture
- Mode parameter can disable extra logic checks, increasing speed for live sites
- Access individual post items for chunk-templates via the [+item[#]+] placeholder
- Extensive logic and sanity checks ensure the values you enter will either work correctly and failures result in helpful messages about potential problems
- Simplified parameter names all in camel case
- RSS & JSON output
- Advanced filtering (<, >, <=, >=, !=, == operators based on code by omnivore) gives the ability to create categories listings based on TVs
- Multilanguage capability (backwards compatible with NewsListing language files with a few additions)
- xHTML strict month based archives with templating
- Fullname for authors with username fallback from FS#268
- Alt-First-Last row template support (inspired by omnivore's post)
- Ability to call all parts of the document object in a template via [+documentobject+] and all tv's via [+tvnameoftv+] (note “tv” prefix)
- Multilevel/hierarchal support
- Sort results based on the values of TVs
- Pagination including a list of pages
- Multisort capabilities
- Multicall abilities/toggle archives
Important Notes
- In pagination mode (&paginate=`1`) always call the snippet uncached
- Also, in pagination mode, make sure to use the placeholders for navigation as the are not added automatically to the start or end.
- To display tv's make sure you use the tv prefix! For example, if you have the template variable author you would put [+tvauthor+] in your template.
Resources
Language Files
- English (Included)
Examples
Standard call
[[Ditto? &tpl=`DittoTemplate` &startID=`2` &summarize=`3` &commentsChunk=`FormBlogComments`]]
Pagination call
[!Ditto?
&startID=`2` &tpl=` DittoTemplate ` &summarize=`3` &multiLevel=1
& &paginate=`1` &paginateAlwaysShowLinks=`1`]]
Example of pagination placeholder use:
<div
id=”ditto_wrapper“>Page <strong>[+current+]</strong> of
<strong>[+total+]</strong> Articles <div
id="ditto_pages">[+previous+] [+pages+]
[+next+]</div></div>
Example CSS:
#ditto_wrapper .ditto_article {
margin-bottom: 20px;
}
#ditto_wrapper .ditto_title {
font-size: 115%;
width: 100%;
border-bottom: 1px solid #9c0;
}
#ditto_wrapper .ditto_title .ditto_info {
float: right;
display: block;
text-align: right;
font-size: 75%;
color: #555;
}
#ditto_wrapper .ditto_link {
text-align: right;
font-size: 75%;
}
#ditto_wrapper a, #ditto_wrapper a:visited, #ditto_wrapper a:hover {
border: 0;
}
.ditto_paging {
border-top: 1px solid #ccc;
padding: 10px;
font-size: 86%;
color: #618100;
}
#ditto_pages #ditto_currentpage {
border: 1px solid #618100;
padding: 1px 5px 2px;
margin-right: 1px;
background-color: #9c0;
color: #fff;
}
#ditto_pages .ditto_off {
border: 1px solid #ccc;
padding: 1px 5px 2px;
margin-right: 1px;
color: #ccc;
}
#ditto_pages a, #ditto_pages a:link, #ditto_pages a:visited {
border: 1px solid #9c0;
padding: 1px 5px 2px;
margin-right: 1px;
text-decoration: none !important;
color: #618100;
}
#ditto_pages a:hover {
background-color: #fff;
color: #000;
}
#ditto_archivelist ul {
list-style-type: none;
margin-left: 15px;
padding-left: 0;
}
#ditto_archivelist ul ul {
list-style-type: square;
margin-left: 35px;
}
#ditto_archivelist .ditto_month {
font-weight: bold;
}
Customization
Creating a new template:
To create your own templates you will need to have some knowledge of how HTML works.
1. Create a chunk based on following code and note its name. This document will assume you named it DittoTemplate.
Default display template (tpl):
<div
class="ditto_summaryPost">
<h3><a
href="[~[+id+]~]">[+title+]</a></h3>
<div>[+summary+]</div>
<p>[+link+]</p>
<div
style="text-align:right;">by
<strong>[+author+]</strong> on [+date+]</div>
</div>
Available placeholders
- Any document object (list) in the format of [+documentobject+]
- Any template variable in the format of [+tvnameoftv+]
- [+next+] - next button
- [+previous+] - previous button
- [+splitter+] - splitter if always show is 0
- [+pages+] - page list
- [+totalpages+] - total number of pages
- [+start+] - the # of the first item shown
- [+stop+] - the # of the last item shown
- [+current+] - the # of current page shown
- [+total+] - the total # of items
- [+item[x]+] – rendered output of an individual document
2. Append &tpl=`DittoTemplate` to your snippet call and Ditto
will use your custom template
Credits:
- This snippet would not have been possible without Alex Butter’s original work on Newslisting for Etomite.org, which started us down this road, along with several improvements from other authors including LePrince, mrruben5 and lloyd_barrett.