I'm thankful to find this forum! Thanks in advance to all for reading and especially to those who comment. I'm definately a newbie to PHP, but pretty motivated having just returned from a 5 day PHP class.
My question:
I'm managing a site that uses PHP 4x, MySQL, and Smarty.
I run a fairly large query in the source PHP that joins 4 tables and the results are set to variable $providers_query, that I then pass over to Smarty.
I list the results by looping through with the section command:
{section name=i loop=$providers_query}
One of the fields I display is the phone number,
{$providers_query[i].phone}
The phone number data is stored as straight unformatted digits, i.e., "3095551212". I want to format the number as (309) 555-1212.
I found a php function that does this, but I'm not sure how to run that function before passing it over to the "section" loop in Smarty along with the other $providers_query.
Alternatively, I found a Smarty modifier plugin that does the same, but even though I copied it to my Smarty templates dir, when I run the code, I get "unrecognized tag: transformPhone|$providers_query.phone ..<snip>
Am I missing how to correctly enable the custom smarty modifier?
Or, is there a way to reformat the data within the query before it gets passed to Smarty?
THANK YOU!