PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, March 9, 2022

[FIXED] Is there a way to call the __d function in Cakephp 3 in a twig template?

 March 09, 2022     cakephp-3.0, twig     No comments   

Issue

I have installed wyrihaximus/twig-view in a CakePHP app which works fine except I don't know how to call the function __d() or any of the other related translate functions.

How do I access them?

EDIT

Specifically when I call {{ __('Hello') }} or {{ __d('Domain', 'Hi') }} functions I get the unknown __ function or unknown __d function error.


Solution

In accordion with the doc here, in the Functions section:

__d maps to __d

So simply try something like this:

{{__d('my_plugin', 'Trending right now')}}

Hope this help



Answered By - Matteo
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing