2018-04-27, 08:42

Feb 27, 2012 — Notify Users module, ver. 0.5 released — user can choose between sending single message (...) »

2013-01-28, 08:32

19 студзеня 2013 у Гродне трагічна загінуў паэт, журналіст і мой сябар (...) »

2009-10-14, 07:19

The site Litaratura.org is devoted to Belarusian literary works and translations. (...) »

2009-01-12, 20:46

Late November 2008 marked the 20th anniversary of the official founding of the Belarusian (...) »

Registered User Area Log into This Site
Show Credits... Credits
Worthwhile Services
Refresh My Local Time (GMT+1)... Apr 27, 2018 — 08:42
  • Austria (1)
    Norway (1)
    Sweden (2)
    United States (7)
  • Today (113)
  • Yesterday (451)
~ / Public Domain Software / Extensions to Ditto / Glossary Tutorial $_
Glossary Tutorial
Click To View A Full Size Image...
2010-01-10, 18:43

This is a comprehensive tutorial how to build a glossary (doc id=109) with active/ inactive letter buttons depending on actual presence of documents in container(s) being the subject of search (id=49).

Example of directory structure

Makers (id=49)
Glossary (id=109)

We will need three chunks, for example, named: „empty”, „one-letter”, and „index”.

Chunk „empty”


The above is used for generating empty output — „none” placeholder stands for non-existent template variable which, at a runtime, will be replaced by Ditto with empty text.

Chunk „one-letter”

<li><a href="[~[+id+]~]">[+lastname+]</a></li>

This chunk is used for generating listing of documents whose filtered template variable (lastname) starts with specific letter.

We need to put into content field of each A, B, C, ..., Z document the following Ditto call:

Single letter listing

<ul>[[Ditto? &parents=`49` &depth=`1` &display=`all` &tpl=`one-letter` &noResults=`empty` &filter=`lastname,[*pagetitle*],11` &sortBy=`lastname` &sortDir=`ASC`]]</ul>

Next we need to build an index in „Glossary” document; for this purpose we put into the content of this document the following Ditto call:

Glossary buttons

[[Ditto? &parents=`109` &depth=`1` &display=`all` &tpl=`index` &sortBy=`pagetitle` &sortDir=`ASC`]]

And finally, the most sophisticated part of this task:

Chunk „index”

[+phx:if=`[[Ditto? &parents=`49` &depth=`1` &tpl=`one-letter` &noResults=`empty` &filter=`lastname,[+pagetitle+],11`]]`:is=``:then=`[+pagetitle+]`:else=`<a href="[~[+id+]~]">[+pagetitle+]</a>`+]

This solution was originally posted to this thread on MODx Forum.

Click to show a form...Click to hide the form... Write a comment
  • Required fields are marked with *.
  • Comments are published after the approval of the site owner, who is a human rather than a wind-fast computer program so please be patient.

* Code:
Get another image...Enter this code into the appropriate field of the form while submitting an e-mail or a comment. If you have trouble with reading it, generate another...