Jump to content

Ultra NOOB question about strings


Who8MyFish

Recommended Posts

So I'm using simplexml_load_file($url) to load up a client's XML file so I can use it with a jQuery slide show right.

 

My problem is that some of the strings within the xml files are often times sentences and when I echo, for example...

 

 echo $xml->images->categories->category[$gallery]->images->image[0]->description[0]

;

 

I should see Dream as if you'll live forever, Live as if you'll die today but all I'm getting is Dream as if you

 

It appears as though php is getting confused when it sees those little single quotes.

 

Anyone?

Link to comment
Share on other sites

Have you looked at the actual HTML source code? Depending on the context of how you are actually echoing that content it could be that the output is all there, but that the rendered HTML doesn't display it. For example, this HTML code would produce the result you describe

<a href='#' title='Dream as if you'll live forever, Live as if you'll die today'>Link</a>

Link to comment
Share on other sites

The problem was in the html. the ' in "you'll" was somehow being switched to a doublequote and so the elemnt looked a little like this.

<a href='#' title='Dream as if you'll live forever, Live as if you"ll die today'>Link</a>

 

 

A simple htmlspecialchars($myString, ENT_QUOTES); took care of that reallll quick. Thanks for the help though, spot on!

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.