Let’s step back a minute (and I don’t mean to be critical, just trying to help). Your snippet in the previous message won’t actually do anything. It calls getChunk() which returns the contents of the chunk but your snippet doesn’t set a variable there or return anything so it won’t have any effect other than to waste a little of the processor’s time.
A more serious problem, though, is the way the template and the chunk would interact even if you solved the above problem.
What you actually want, I think, is to use a single template for all devices, mobile or not, but with different CSS. As long as each device has a separate CSS file (or chunk), you can control how everything looks and what is visible (and what isn’t) in every user agent.
So your single template will have separate divs and spans and all the HTML code. Your CSS chunks (or files) will style all those divs and spans etc. for the appropriate user agent.
In that scenario, your version of the snippet in the previous message should work fine as long as you change the last line to
$modx->regClientCSS($modx->getChunk($chunkName));
That will inject the CSS into the head section of the template.
Note that doing it this way, the snippet call should be alone, not in a tag, because it doesn’t create any output at it’s own location. Instead it injects the CSS from the chunk or file into the <head> section of the document. Note also that for this to work, your chunks or files need to have the CSS code wrapped in a <style> tag like this:
<style> CSS here </style>.
Just for clarification, in my original snippet, the single template contains an <href> tag referencing the file with the CSS. The snippet just provides the *name* of that file -- the file provides the CSS. Using chunks which contain the CSS won’t work with that tag because the href tag expects a filename -- not CSS content.
I hope this makes sense.