Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Use CHUNKS instead of an inline tpl #6

Closed
Mark-H opened this Issue · 7 comments

2 participants

@Mark-H

I often have uses working with extra this snippet.. issues with output filters and the like, and I think many of them are caused by the fact we're forced to use an inline template. MODX parses recursively so I'm going to guess that whenever an output filter is used, the entire placeholder is REMOVED, and FileDownload R cannot access it. I've had the same issue with the Login snippet for example, but at least that one offers the possibility to use a chunk.

Using chunks will fix issues like these. Keep it as an option if you worry about backwards compatibility.

@goldsky
Owner

hmm... you just remind me my ajax parsing problem.

anyway,
in what way do you need an output filter in here?

@Mark-H

I'm passing the [[+link]] property to a JS function to popup a "listen" box that will play the chosen mp3. But I needed to urlencode the link to properly pass it through. Ended up fixing it by urlencoding it in the js function itself, but an output filter would've saved me 15 mins figuring out how to get around this :)

@goldsky
Owner

and what did stop you to create chunk?
it'll check the database first.

@Mark-H

I can't pass a chunk name to FileDownloadLink can I?

This is what the docs say (and because of that I didn't bother looking into the code either):

The template for this snippet is a plain href link with FileDownloadLink's placeholders, not a chunk or a template file.
@Mark-H

If you're suggesting to put this:

[[!FileDownloadLink? &getFile=`[[+file]]` &tplCode=`[[$mytpl]]`]]

that'll have the same effect and I encourage you to read this article on how nested tags are processed: http://www.markhamstra.com/modx-blog/2011/11/nested-caching-in-modx-revolution/

@goldsky
Owner

wowww...
that's a hell of the trick!

@goldsky
Owner

you can upgrade to rc2, now
the parser has been refactor, and you can use @BINDINGs , or just the chunk's name.
bbdc040#L5R440

@goldsky goldsky closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.