a-ok Posted June 11, 2018 Posted June 11, 2018 I'm curious. In order to share a link via Twitter you do something like the following https://twitter.com/intent/tweet?text=<?php echo $page->title; ?>&url=<?php echo $page->httpURL; ?>&via=processwire And in most instances that works fine. However, if the page title has an ampersand in it then it breaks the text. I've looked at using $sanitizer for this but doesn't seem to do the job. What I've found out works is the following: htmlspecialchars(urlencode(html_entity_decode($page->title, ENT_COMPAT, 'UTF-8')), ENT_COMPAT, 'UTF-8'); However I'm wondering if there is a way to use $sanitizer to achieve this? Or some other way with the API? Thanks!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now