Need help with php and preg_replace

Discussion in 'HTML & Website Design' started by General Grant, Apr 19, 2009.

  1. #1
    Here's a test of what I'm working on:
    http://www.bikerleatherbarn.com/tag.php

    What I'm looking to do is have the tags display like "blue widget", but the url will be http://www.domain.com/search-blue+widget-blended,(notice the + between blue and widget). I somehow need to replace a space ( ) with +. Below is the code for that page:

    I know it has something to do with the line "return preg_replace('/\s\s+/', '+', $cloud_html);", but I'm not savvy enough with PHP to figure it out. As it is now, it's replacing two spaces ( ) rather than one space ( ) with the +. How do I replace just one space instead of 2 with a +? I'd also like the + not to show in the tag itself, but just in the url. I've tried for hours with no luck, can someone help me with this? I hope I've made myself clear...
     
    General Grant, Apr 19, 2009 IP
  2. sliver

    sliver Peon

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    i don't know if i've understand what you mean but...if you want only 1 '+' in the URL it should be done in javascript
     
    sliver, Apr 19, 2009 IP