New Utilities section details Pogwatch tools and techniques
22 Jul 2009 MODx
Pogwatch now has a Utilities section, giving details of plugins, snippets, tools and techniques used to produce the documentation pages.
The first two features describe a plugin that helps to display the text of MODx placeholders and other elements that would normally be parsed or come out as blanks, and a wrapper snippet that displays the text of a snippet call above its result. These are used extensively in the Ditto section. Thanks to Susan Ottwell for the simple explanation of how plugins work, and to Shane Sponagle for the low-down on wrapper snippets.
Point to note if you start making plugins: the code is not wrapped in <?php and ?>, unlike snippets. Banged my head against the wall for quite a while with that one, until I found a relevant forum post.
A tool I've used in the Utilities section is GeSHi (Generic Syntax Highlighter), to produce syntax highlighting in listings of PHP scripts. I've always wondered how those pretty colours were produced in the forum [code] sections, and a little research led to the built-in PHP functions highlight_string() and highlight_file(). A little further research led to some shortcomings, and then to GeSHi, which is very adaptable and can deal with a variety of languages.
The listings necessitate a lot of SPAN tags as colour switches repeatedly, so I have set them to use an external CSS file, to avoid masses of in-line style definitions. Files in the Utilities folder have a template variable called listing, and the style sheet is included in the standard site template's HEAD section when listing is set. This is achieved using PHx: [+listing:is=`1`:then=` ... stylesheet link ... `+]
Posts: 1
Reply #1 on : Thu July 23, 2009, 14:01:35