ack search for content within Smarty TPL template files
-
17-06-2021 - |
سؤال
Is it possible to use ack
to search for content within Smarty template files (.tpl)?
At the moment I can only search within the cached version of these templates, which themselves are PHP files.
If I do a case-insensitive ack
search like this below this is what is returned:
[crmpicco@dev dev_crmpicco]$ ack -i select\ the\ course
cache/templates/gb/%%9B^9B3^9B37B147%%course.tpl.php
48: <p><label>Select the course:</label></p>
64: <p><label>Select the course:</label></p>
83: <p><label>Select the course:</label></p>
المحلول
It sounds like what you're asking is "How do I get ack 1.x to recognize .tpl as a valid filetype?"
What you want is to put --type-set=smarty=.tpl
on the command line or in the ACK_OPTIONS environment variable or in your .ackrc file. Then you can say things like "ack --smarty foo" and it will only search smarty files.
You probably also want to use --ignore-dir=cache
so ack doesn't search in your cache directory.
Case sensitivity is unrelated to the issues here.
نصائح أخرى
Your question isn't clear...
If you want to find filename of template, which is filled with some content after render, here is it (wtih bold):
cache/templates/gb/%%9B^9B3^9B37B147%%course.tpl.php