Forum


Replies: 5   Views: 31
How to add url link in text type placeholder

Posted by admin  · 14-01-2025 - 07:13

Hello,

Please check and run the following sample included in the package: examples/Templates/replaceVariableByWordFragment/sample_2.php . This sample replaces a placeholder in a template with a new WordFragment that includes an image, a link, and a footnote.

The problem with your script is that it's using a new CreateDocx object instead of the DOCX template object to generate the WordFragment. Instead of:

$docx = new CreateDocx();
$wf = new WordFragment($docx);

it needs to use the DOCX template object, not a new object:

$wf = new WordFragment($templateDocx);

Also note that if you want to add a link to a URL you need to use http or https:

$url = 'https://www.hdfcfund.com';

otherwise, a local link is generated.

Regards.