XF 2.1 dynamic value in phrase??

sajal

Active member
I have stored the phrase value in database for my custom plugin, and now I want to fetch it and display it by using the phrase in template. But I get following error.

"Phrase name must be literal"

Any way for the phrase to use value from variable?
 
Not directly in a template, because phrase usage is computed during template compilation so the necessary phrases can be cached up-front. You can call a PHP method which returns a phrase though. If you're doing that with multiple phrases, use phrase groups if possible (name your phrases group.name). The entire group will be fetched at once to avoid querying them individually.
 
Last edited:
Back
Top Bottom