View Single Post
  #1  
Old 04-07-2015, 10:27 AM
 
keystone keystone is offline
 

X-Adept
  
Join Date: Jul 2006
Location: USA
Posts: 787
 

Default 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}&amp;url={$http_location}/{$canonical_url}&amp;via={$config.Company.company_name}" target="_blank"> <i class="fa fa-twitter"></i> </a>

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&amp;url=http://www.uscandleco.com/product.php?productid=153728&amp;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.
__________________
www.uscandleco.com - X-Cart Version 4.7.11 Gold Plus php7.3
mods:
reCaptcha
running on UNIX

www.keystonecandle.com X-Cart Gold Plus - Version 4.7.11 php7.2
mods:
reCaptcha
cdseo pro
running on UNIX
Reply With Quote