Hello,
The support of placeholders replacement in headers and footers by WordFragments and HTML was added in phpdocx 4.6, so we recommend you to upgrade to use this feature.
About your other question, you need to set the target parameter to 'footer' or 'header' to replace the correct scope. Please check the documentation available on:
http://www.phpdocx.com/api-documentation/templates/replace-variable-text-Word-document
Regards.