Hi,
I may be going about this the wrong way but I hope someone can help.
I have a snippet which generates a random number based on the date and the number or articles in my site. I intend to use this to produce an ’article of the day’ feature for my frontpage. I want to do this by using the &start param in Ditto and so far my ditto call looks like this:
[!Ditto? &startID=`49` &tpl=`ditto_machines_load` &sortBy=`longtitle` &sortDir=`ASC` &display=`1` &start=`5` &descendentDepth=`1`!]
As you would expect, it currently displays the fifth article of my set because &start is set to `5`. My question is; how do I set &start to the result of my random number snippet?
I tried that and it didn’t work. Perhaps my problem is in my random snippet, how should I be outputting my result in the random snippet?
-
☆ A M B ☆
- 24,524 Posts
A snippet should always "return" its value;
$value = 'whatever';
return $value;
-
☆ A M B ☆
- 24,524 Posts
Snippets are run through the PHP eval() function, so a snippet should be treated as if it were a function. That’s why it should always return something, even an empty string if for some reason it doesn’t have an output to display.