![]() |
how do I remove spaces in sharing button urls
I have sharing buttons on my site. An example of one is for twitter. Here is the template code that creates the link from my product.
Code:
<a class="btn btn-info ttip_n" title="Twitter" href="//twitter.com/intent/tweet?text={$product.product}&url={$http_location}/{$canonical_url}&via={$config.Company.company_name}" target="_blank"> The problem is that my product names have spaces in them so the actual URL comes out looking like this. Code:
<a class="btn btn-info ttip_n" title="Twitter" href="//twitter.com/intent/tweet?text=Balsam Fir 2x3 Pillar Candles&url=http://www.uscandleco.com/product.php?productid=153728&via=U.S. Candle Company" target="_blank"> <i class="fa fa-twitter"></i> </a> Is there a way to replace the spaces in the URL with + or %20 so that they will validate in w3c? Thanks. |
Re: how do I remove spaces in sharing button urls
Try...
Code:
<a class="btn btn-info ttip_n" title="Twitter" href="//twitter.com/intent/tweet?text={$product.product|replace:" ":"%20"}&url={$http_location}/{$canonical_url}&via={$config.Company.company_name|replace:" ":"%20"}" target="_blank"> |
Re: how do I remove spaces in sharing button urls
that worked, thanks Phil.
|
All times are GMT -8. The time now is 01:18 AM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.