NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page PHP - Replacing blanks with +

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search
5 members in live chat ~  


Reply
 
LinkBack Thread Tools
Old 10-29-2010, 05:39 PM THREAD STARTER               #1 (permalink)
NamePros Regular
 
freeflow's Avatar
Join Date: Dec 2006
Posts: 236
freeflow is on a distinguished road
 



PHP - Replacing blanks with +


Hi everyone,

How can I replace the blanks with + in red variable?

Code:
 class RSSParser { 

   var $insideitem = false; 
   var $tag = ""; 
   var $title = ""; 
   var $description = ""; 
   var $link = ""; 

   function startElement($parser, $tagName, $attrs) { 
       if ($this->insideitem) { 
           $this->tag = $tagName; 
       } elseif ($tagName == "ITEM") { 
           $this->insideitem = true; 
       } 
   } 

   function endElement($parser, $tagName) { 
       if ($tagName == "ITEM") { 

            
           print " 
           <b>" . $this->title . "</b> 
           <div class=\"text\">" . $this->description . "<br /><a href=\"" . $this->title . "\" target=\"_blank\"></a></div><br />";
Thanks.
freeflow is offline   Reply With Quote
Old 10-29-2010, 05:52 PM   #2 (permalink)
NamePros Member
Join Date: Nov 2003
Location: Ontario, Canada
Posts: 127
eagle12 will become famous soon enougheagle12 will become famous soon enough
 



str_replace(" ","+",$this->title)

---------- Post added at 12:52 AM ---------- Previous post was at 12:50 AM ----------

Personally, if you are trying to parse an RSS feed, I would just SimpleXML. If you need help, PM me.
eagle12 is offline   Reply With Quote
Old 10-29-2010, 07:01 PM THREAD STARTER               #3 (permalink)
NamePros Regular
 
freeflow's Avatar
Join Date: Dec 2006
Posts: 236
freeflow is on a distinguished road
 



It worked! Thanks.
freeflow is offline   Reply With Quote
Old 11-04-2010, 01:49 AM   #4 (permalink)
Tech Support
Join Date: Mar 2005
Posts: 4,944
Eric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatness
 

Member of the Month
MOTM September 2005
Save a Life Child Abuse 9/11/01 :: Never Forget Baby Health Marrow Donor Program AIDS/HIV Breast Cancer Animal Rescue Cystic Fibrosis Ethan Allen Fund Animal Cruelty Ethan Allen Fund Ethan Allen Fund Baby Health Cancer Alzheimer's Protect Our Planet Cancer Survivorship SIDS Child Abuse Diabetes Protect Our Planet Multiple Sclerosis Autism Adoption Special Olympics
I would recommend using urlencode($this->title) - it will make sure that other characters are also url friendly (other than space -> +)
Eric is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Your thoughts on "z" replacing "s" in domain names? Phare Domain Name Discussion 13 04-25-2010 02:29 PM
Domainer by day a---- by night (fill in the blanks) sirengirl The Break Room 34 04-14-2010 02:22 PM
Fill in the blanks: "Because of the sale of (name) for $(amount), I got (name) Domainate.com Domain Name Discussion 4 04-25-2006 05:37 AM
Replacing 'S' with 'Z' Mattias Domain Newbies 6 04-23-2006 07:30 AM

 
All times are GMT -7. The time now is 02:39 PM.

Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger