Submit Your Article Forum Rules Search
WebProWorld
Register FAQ Calendar Mark Forums Read
Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Share Thread: & Tags

Share Thread:

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-19-2007, 01:14 AM
edhan's Avatar
WebProWorld Veteran
WebProWorld MVP
 
Join Date: Aug 2003
Location: Singapore
Posts: 738
edhan RepRank 4edhan RepRank 4edhan RepRank 4edhan RepRank 4
Question RSS Problem

Hi

I hope this is the right place to ask this question.

I am creating a RSS feed for my video site but encounter a problem to display RSS feed when there is a & (ampersand) on the title page. The RSS feed will not display and checking on the problem, it say error due to whitespace.

Does anyone has any idea how to overcome this problem?

I did a test by typing & in the title page instead of just & and it works. But unfortunately I will not be able to control others from just typing & instead of & so wondering if anyone has a solution for this RSS feed problem.
Reply With Quote
  #2 (permalink)  
Old 09-19-2007, 01:17 AM
freelancedesigners.com's Avatar
WebProWorld Member
 
Join Date: Sep 2005
Location: US
Posts: 26
freelancedesigners.com RepRank 1
Default Re: RSS Problem

you have to filter your users input before you save it

in cold fusion you use <cfset input = replace(input,'&','&amp;','all')>

php, asp, etc all have similar functions

HTH
__________________
-Webmaster Wes | Don't go and misunderestimate me!
Graphic Design Jobs | Web Design | Ninja Freelance | Ancient Ninja Wisdom
Reply With Quote
  #3 (permalink)  
Old 09-19-2007, 04:43 PM
WebProWorld Veteran
 
Join Date: Apr 2004
Posts: 356
imvain2 RepRank 2
Default Re: RSS Problem

I agree with freelanddesigners.com

This is only an issue when generating the rss feed. So in your rss feed generating script just replace the & with &amp;

PHP:
$Title = str_replace("&", "&amp;", $Title);
Reply With Quote
  #4 (permalink)  
Old 09-19-2007, 05:04 PM
WebProWorld New Member
 
Join Date: Jun 2005
Location: Colorado
Posts: 20
hyperdog RepRank 0
Default Re: RSS Problem

If it isn't your site, you could run it through Yahoo pipes, perhaps. The code solutions - and staying on your site - are much better though.
__________________
Colorado Web Development
Reply With Quote
  #5 (permalink)  
Old 09-19-2007, 06:08 PM
thindenim's Avatar
WebProWorld Pro
 
Join Date: Jan 2007
Location: Scotland
Posts: 256
thindenim RepRank 2
Default Re: RSS Problem

I had some problems with this before. There is an html_entities function in PHP, which is supposed to help, but I found it was still causing me problems. Ended up writing the following function, which covers just about everything I think! Overkill for ampersand obviously, but you may have problems with other special characters down the line.

Of course this will be no use if you are not using PHP!

Edit: Function uploaded to http://www.tdserver.co.uk/xml_rewrite.txt

Hope this helps!
__________________
Girlz Night - professional hair and beauty products
Web design glasgow - from Thin Denim

Last edited by thindenim; 09-19-2007 at 06:15 PM. Reason: code screwed up
Reply With Quote
  #6 (permalink)  
Old 09-19-2007, 07:11 PM
TrafficProducer's Avatar
WebProWorld 1,000+ Club
WebProWorld MVP
 
Join Date: Jul 2003
Location: United Kingdom
Posts: 1,665
TrafficProducer RepRank 4TrafficProducer RepRank 4TrafficProducer RepRank 4
Default Re: RSS Problem

I use:-


RSS Builder --- free ---
RSS Builder is an easy to use program to create RSS news feeds and podcasts for your web site. It provides a simple interface that lets you add topics, links, content, and enclosures, then publish the RSS (v2.0) feed to your web server, using the built-in FTP client.



(The HTML edite option, displays/edit WYSIWYG)

Nar You. Information. Research. News. Publish your own RSS Feed FREE Webpage at Nar You. Information. Research. News.
Reply With Quote
  #7 (permalink)  
Old 09-20-2007, 05:07 AM
brucet's Avatar
WebProWorld Member
 
Join Date: Feb 2004
Location: London, UK
Posts: 72
brucet RepRank 0
Default Re: RSS Problem

We had exactly the same problem. Replacing the ampersand with %26 fixed it.
__________________
Bruce Townsend
Actinic ecommerce software, ecommerce website design
Reply With Quote
  #8 (permalink)  
Old 09-20-2007, 10:08 AM
edhan's Avatar
WebProWorld Veteran
WebProWorld MVP
 
Join Date: Aug 2003
Location: Singapore
Posts: 738
edhan RepRank 4edhan RepRank 4edhan RepRank 4edhan RepRank 4
Smile Re: RSS Problem

Hi

Thank you all for your suggestion. I will try them and see which one helps to resolve my issue.

As my RSS Feed for my site is random, is there a way to update the database for all existing & with &amp; ?

Thanks for all your kindest suggestion.
Reply With Quote
  #9 (permalink)  
Old 09-20-2007, 10:25 AM
wige's Avatar
Moderator
WebProWorld Moderator
 
Join Date: Jun 2006
Location: United States
Posts: 2,822
wige RepRank 10wige RepRank 10wige RepRank 10wige RepRank 10wige RepRank 10wige RepRank 10wige RepRank 10wige RepRank 10wige RepRank 10wige RepRank 10wige RepRank 10
Default Re: RSS Problem

The problem with running something on your database is that if the data is used in other parts of your site, other apps might break. If possible, I would recommend editing the script that displays the RSS file to the viewer to replace the ampersands.
__________________
The best way to learn anything, is to question everything.
Reply With Quote
  #10 (permalink)  
Old 09-20-2007, 11:26 AM
edhan's Avatar
WebProWorld Veteran
WebProWorld MVP
 
Join Date: Aug 2003
Location: Singapore
Posts: 738
edhan RepRank 4edhan RepRank 4edhan RepRank 4edhan RepRank 4
Thumbs up Re: RSS Problem

Hi

I have tested as all suggested and found suggestion by imvain2 on this works perfectly!

PHP:
$Title = str_replace("&", "&amp;", $Title);

I used thindenim method but it scrambled up the RSS feed though it works too.

Yes, I do agree with wige as it is best to do that.

Thanks a million for all your help that I have resolved this issue.
Reply With Quote
  #11 (permalink)  
Old 09-20-2007, 12:28 PM
thindenim's Avatar
WebProWorld Pro
 
Join Date: Jan 2007
Location: Scotland
Posts: 256
thindenim RepRank 2
Default Re: RSS Problem

Glad to hear it's all working, I know from experience it can be frustrating.
__________________
Girlz Night - professional hair and beauty products
Web design glasgow - from Thin Denim
Reply With Quote
  #12 (permalink)  
Old 09-28-2007, 09:18 AM
edhan's Avatar
WebProWorld Veteran
WebProWorld MVP
 
Join Date: Aug 2003
Location: Singapore
Posts: 738
edhan RepRank 4edhan RepRank 4edhan RepRank 4edhan RepRank 4
Question Re: RSS Problem

Yes. Glad that I got rid of the frustration especially RSS is so common nowadays.

BTW, do you know how do I program to show the correct URL with 2 different link_identifiers but with only one printout.

One is $db1 and the other is $db2.


print "<title>";
print "$db1";
print "</title>\n";

What can I do so it can select either $db1 or $db2 ?
Reply With Quote
  #13 (permalink)  
Old 09-28-2007, 09:32 AM
kgun's Avatar
WebProWorld 1,000+ Club
WebProWorld MVP
 
Join Date: May 2005
Location: Norway
Posts: 5,944
kgun RepRank 10kgun RepRank 10kgun RepRank 10kgun RepRank 10kgun RepRank 10kgun RepRank 10kgun RepRank 10kgun RepRank 10kgun RepRank 10kgun RepRank 10kgun RepRank 10
Default Re: RSS Problem

First of all RSS is XML, that is not-wellformed and therefore invalid with & but well-formed and valid with &amp;

That was solved though.

To your second question, can that not be done with XSL(T) or PHP or whatever scripting language you use, conditional programming?

Quote:
Originally Posted by edhan View Post
BTW, do you know how do I program to show the correct URL with 2 different link_identifiers but with only one printout.
May be you need to use XLink. See the second link in my signature + first link for articles about the XLink language.
__________________
Mini Network:: Financial information at your fingertips
Learn object oriented programming where it started

I will use a search engine before I ask dumb questions.

Last edited by kgun; 09-28-2007 at 09:42 AM.
Reply With Quote
  #14 (permalink)  
Old 09-28-2007, 09:43 AM
edhan's Avatar
WebProWorld Veteran
WebProWorld MVP
 
Join Date: Aug 2003
Location: Singapore
Posts: 738
edhan RepRank 4edhan RepRank 4edhan RepRank 4edhan RepRank 4
Default Re: RSS Problem

Okay. Checking out your site now. Interesting to see that your daughter designs your first webpage.

Will let you know if your site has the solution for me.

Thanks!
Reply With Quote
  #15 (permalink)  
Old 09-28-2007, 09:50 AM
kgun's Avatar
WebProWorld 1,000+ Club
WebProWorld MVP
 
Join Date: May 2005
Location: Norway
Posts: 5,944
kgun RepRank 10kgun RepRank 10kgun RepRank 10kgun RepRank 10kgun RepRank 10kgun RepRank 10kgun RepRank 10kgun RepRank 10kgun RepRank 10kgun RepRank 10kgun RepRank 10
Default Re: RSS Problem

Yes, and you are aware of all the PHP inbuilt functions like $_SERVER etc?

P.S. Helene, my daughter designed the background in Adobe Photoshop some years ago. Now, she is educating herself as a teacher for art designers. May be, it was the second site? I am not 100 % sure.

The Epost on that site should have been eliminated, since it has a 100 % filter. It can fool somebody to contat us.
__________________
Mini Network:: Financial information at your fingertips
Learn object oriented programming where it started

I will use a search engine before I ask dumb questions.

Last edited by kgun; 09-28-2007 at 10:09 AM.
Reply With Quote
  #16 (permalink)  
Old 09-28-2007, 10:10 AM
edhan's Avatar
WebProWorld Veteran
WebProWorld MVP
 
Join Date: Aug 2003
Location: Singapore
Posts: 738
edhan RepRank 4edhan RepRank 4edhan RepRank 4edhan RepRank 4
Question Re: RSS Problem

Yes, I am doing it as XML version=1.0. XLink seems to be able to do what I want but looking through your site, I am totally confused.

It mentions about locator and able to assign X and Y. Due to my limited knowledge, I doubt I am able to write that.

I am extracting images with description from the database by using mysql_fetch_array. Most of the images comes from one source URL but occasionally I will have one or two comes from different URLs so I am trying to figure out how I can do a link when a different URL for the image is needed.

Does anyone has any idea how to program the condition for checking?

I like the hearts floating in the air for your daugher's website.
Reply With Quote
  #17 (permalink)  
Old 09-28-2007, 10:47 AM
kgun's Avatar
WebProWorld 1,000+ Club
WebProWorld MVP
 
Join Date: May 2005
Location: Norway
Posts: 5,944
kgun RepRank 10kgun RepRank 10kgun RepRank 10kgun RepRank 10kgun RepRank 10kgun RepRank 10kgun RepRank 10kgun RepRank 10kgun RepRank 10kgun RepRank 10kgun RepRank 10
Default Re: RSS Problem

Quote:
Originally Posted by edhan View Post
Yes, I am doing it as XML version=1.0. XLink seems to be able to do what I want but looking through your site, I am totally confused.
You noted the two XLink articles?

Quote:
Originally Posted by edhan View Post
I am extracting images with description from the database by using mysql_fetch_array. Most of the images comes from one source URL but occasionally I will have one or two comes from different URLs so I am trying to figure out how I can do a link when a different URL for the image is needed.
That is the correct way to fetch them from the database in my view.

Quote:
Originally Posted by edhan View Post

Does anyone has any idea how to program the condition for checking?
You can do conditional processing in XSL e.g.

Code:
  • xsl:if
  • xsl:choose, xsl:when and xsl:otherwise

etc. There is also an XPath node-set documnet() function that may be used in combination with XSLT. I am not sure that solves your problem. I think other members should enter the thread with their proposals. One good XML forum is the Norwegian W3 Schools forum. You have some clever guys there that may help you if my hints or other WPW members can not help you.

Quote:
Originally Posted by edhan View Post
I like the hearts floating in the air for your daugher's website.
It is the code of a simple Java applet that we found on the internet. There are 1000's of similar that you can copy free and paste into your code.

You find the most important XML technologies by scrolling down this page.
__________________
Mini Network:: Financial information at your fingertips
Learn object oriented programming where it started

I will use a search engine before I ask dumb questions.

Last edited by kgun; 09-28-2007 at 10:55 AM.
Reply With Quote
  #18 (permalink)  
Old 09-28-2007, 02:29 PM
edhan's Avatar
WebProWorld Veteran
WebProWorld MVP
 
Join Date: Aug 2003
Location: Singapore
Posts: 738
edhan RepRank 4edhan RepRank 4edhan RepRank 4edhan RepRank 4
Question Re: RSS Problem

I was reading up the IF condition but still blur about it.

Anyone knows how I can use this command:

If ....

Elseif ....

Else ....

How do I write this command so that I can extract 2 different link_identifiers but with only one printout using the above command.
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
dns problem? Pascal77 Search Engine Optimization Forum 3 10-23-2006 08:26 PM
Is this a serious SEO problem? Nick-UK Search Engine Optimization Forum 16 09-13-2006 11:35 PM
DIV problem in IE through CSS souravamant Graphics & Design Discussion Forum 3 06-11-2005 06:07 AM
CSS / IE problem... Orion Web Programming Discussion Forum 2 06-21-2004 05:02 PM
Problem with PR strangerrr Search Engine Optimization Forum 2 03-30-2004 10:01 PM


All times are GMT -4. The time now is 04:35 PM.



Search Engine Optimization by vBSEO 3.3.0