How would I go about passing the parameter to Ditto?
Eg i have an A-Z list, I can generate the URL -> the Ditto page call, but how do i pass the letter?
My thoughts are - Make a php snippet which generates the parameters then calls ditto directly?
eg (pseudocode)
[!AtoZ? &search=`a`!]
Or called with pagename?&search=a
where pagename contains [!AtoZ!]
AtoZ code -
<?php
if (isset($_GET['search'])) {
$search = $_GET['search'];
} //Get from ?search = if passed
$search = (isset($search))? $search : 'a'; //default to A if not passed
if (strlen($search)>1) { $search='a';}; //rudimentary param check
$param['parents']='9';
$param['depth']='0';
$param['tpl']='AtoZResults';
$param['where']='pagetitle LIKE "' . $search . '%"';
$output= $modx->runSnippet('Ditto', $param); //Always prefer to put output in a variable
return $output;
?>
It works, but seems a bit dumb. Am I on the right track, or should I be doing it another way?