pyrocms / lex

A lightweight template parser used by PyroCMS.
110 stars 31 forks source link

Using variables within callbacks arguments #10

Closed kureuil closed 11 years ago

kureuil commented 11 years ago

Currently it's impossible to use a variable inside a callback argument. I know it's a lightweight templating engine but could we have the ability to do something like that:

{{ foo:bar arg="herp/{baz}" }}

Or at least something similar.

(Link: https://forum.pyrocms.com/discussion/23562/using-variable-in-fileslisting-does-not-work)

kureuil commented 11 years ago

Nevermind, I just found a workaround in pyro's documentation.

amityweb commented 11 years ago

Dont know how you did it by good collegue here stated you must use double brackets like so, which works for me in the files:listing tag:

{{ foo:bar arg="herp/[[baz]]" }}

RyanThompson commented 11 years ago

Single curlies I believe: {inner_tag}

Sent from my iPhone 5

On Jun 27, 2013, at 5:18 AM, Laurence Cope notifications@github.com wrote:

Dont know how you did it by good collegue here stated you must use double brackets like so, which works for me in the files:listing tag:

{{ foo:bar arg="herp/[[baz]]" }}

— Reply to this email directly or view it on GitHub.

amityweb commented 11 years ago

No, single curlies do not work in this situation, see https://forum.pyrocms.com/discussion/23562/using-variable-in-fileslisting-does-not-work, thats why I asked!

kureuil commented 11 years ago

Yup, the "best" practice I've found is actually to use the double brackets as your collegue told you. Eventually, you can switch to a plugin if you need more flexibility but in most cases double brackets should be enough. Sorry to not have told you @amityweb I've totally forget :(

amityweb commented 11 years ago

Double brackets stopped working for me now I upgraded from 2.2.0 to 2.2.1

amityweb commented 11 years ago

Actually have to use page: before my custom variable so wiorks now, have updated the forum https://forum.pyrocms.com/discussion/23562/using-variable-in-fileslisting-does-not-work