Quote from: rthrash at Jul 18, 2006, 10:31 AM
Why not just have it assign variable values so that there is no extra overhead of parsing parameters?
$parameter="blah";
$param2="blahedy blah blah";
OMG, that’s really neat and really clever. That way... it’s basically just an include! Possibly we could allow PHP in the theme, so the theme itself could do wacky things like check to see if it’s nighttime??
Anyway, themes should NOT use the pass-parameters format, because you need to be passing HTML into the variables. That’s far easier with the $variable = ""; format. A number of snippets already require people to set things in the $ format within the snippet, so it is not another format to worry about - there were always two.
The only issue with that is *when* this happens. I’d prefer:
- Load In Variable Values From Theme File
- Parse Parameters From Snippet Call
- Execute Snippet
so that the parameters in the call could over-ride the theme if necessary.
I’d love to see this as a generic MODx ability available to all snippets.
Any snippet that uses chunks would need an extra $innerTpl
Code variable, and a simple test to see if there’s anything in that before trying the chunk variable, along the lines of:
if ($innerTplCode == "") {
$innerTplCode = GetCodeFromChunk($innerTpl);
}