Replies: 4   Views: 854
Escape single template symbol
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by ascendware  · 30-09-2020 - 06:55

Hi, I've been using the default template symbol '$' for creating documents from templates.

How can I print a single dollar sign in the output document? Or say escape the single dollar sign?

Thank you in advance.

Posted by admin  · 30-09-2020 - 10:11


Sorry but we are not sure if we understand your question correctly. Do you need to add the template symbol to the template before working with phpdocx or using template methods?

If the template symbol is added as regular content in the template in the same paragraph that includes placeholders, we recommend using other symbol to wrap placeholders ( The next version of phpdocx (there's no release date yet) will include support for ${ } syntax and others to wrap placeholders.

You can insert $ using template methods without escaping it.


Posted by ascendware  · 30-09-2020 - 17:06

Hi, sorry if my question is unclear.

I am working on creating a document from templates and is using the dollar($) template symbol to wrap my variable tags.

Ex: $VAR_1$, $VAR_2$, etc..

Everything is working great. However, when it comes to replacing amount/money into the document, the dollar sign has to be used on the template as a unit of currency and not as a delimiter for variable tags.

My question is, is there a way to escape it? Like how we use backslashes to escape single/double quotes from a string?

Example: $$TOTAL_AMOUNT$

Posted by admin  · 30-09-2020 - 17:21


Thanks for sending the requested information.

There's no option to escape that character. When adding the symbol used to wrap placeholders as regular text in the same paragraph of a template, the available solutions are:


Posted by ascendware  · 01-10-2020 - 06:02

Thank you.