This is just playing around with the output filter, as mentioned in the MODx documentation:
http://rtfm.modx.com/display/revolution20/Custom+Output+Filter+Examples. In this case we will create a shortcut to call the lexicon entry.
For example we create a new
namespace for specific template, we call it "
SchoolTemplate", and this namespace has specific lexicon entries in folder:
../assets/templates/SchoolTemplate/lexicon/. To call a lexicon entry with specific topic from this namespace will be:
//Topic: schedule
//Entry: school.playground
[[%school.playground? &topic=`schedule` &namespace=`SchoolTemplate`]]
//Topic: teacher
//Entry: school.salary
[[%school.salary? &topic=`teacher` &namespace=`SchoolTemplate`]]
To make it simple, we create a "LEX" snippet as a shortcut.
<?php
/*
* LEX snippet: having fun with output filter
**/
$topic = (isset($options) and !empty($options))? $options : 'default';
return "[[%school.$input? &topic=`$topic` &namespace=`SchoolTemplate`]]";
So now we can call above example in different way...
[[%playground:LEX=`schedule`]]
[[%salary:LEX=`teacher`]]