Forum


Replies: 3   Views: 1130
Addlink with & parameter
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 admin  · 09-05-2021 - 19:11

Hello,

Please use htmlspecialchars with 'url' in that case:

$docx->addLink('Link to Google', array('url'=> htmlspecialchars('http://www.domain.com?test=111&attr=content')));

We have opened a task to apply htmlspecialchars automatically to 'url' option in addLink in the next release of phpdocx.

Regards.

Posted by Exorion  · 09-05-2021 - 19:52

I mean in 12 version, when we should expect it?

Thanks

Posted by admin  · 10-05-2021 - 06:56

Hello,

There's no release date for the next version of phpdocx. Using phpdocx 11 and previous versions, you can use htmlspecialchars from PHP to add URL with protected XML characters:

$docx->addLink('Link to Google', array('url'=> htmlspecialchars($url)));

You can use the previous code to add links with and without protected XML characters.

Regards.