I've searched and found similar issues but not quite this. I wasn't sure if this is a bug or a support request. Feel free to change it.

I have a content type that contains an imagefield. The image has an associated title (and description). I display the title in the node using this code:

print $item['data']['title'];

In the views, I'm choosing the field Content: Image - data and selecting the imagefield title.

If the title contains an apostrophe, or html code, it displays correctly on the node page but displays as html entities (I think that is the correct term) in the view:

' or <

There is no option to use html formatting for the field as far as I can tell.

It doesn't seem like a CCK bug since it is displaying correctly in the node. Am I doing something wrong or is this a views bug? I hope I didn't just miss a setting somewhere.

The view is attached.

Thanks for taking the time to look at this.

CommentFileSizeAuthor
view.txt35.11 KBron collins

Comments

merlinofchaos’s picture

Project: Views (for Drupal 7) » ImageField
Version: 6.x-2.11 » 6.x-3.x-dev

Image Field is responsible for the display of its own data. This looks like maybe there's a double check_plain() somewhere.

quicksketch’s picture

Thanks for the report. ImageField is indeed the correct place for this issue. I assume you're using the latest 3.9 version, correct?

ron collins’s picture

3.9. Yes.

ron collins’s picture

Version: 6.x-3.x-dev » 6.x-3.9

changing version.

Anonymous’s picture

Subscribing.

Anonymous’s picture

My workaround. Overwrite the output with a template file (views-view-field.tpl.php). This works for me:

<?php $data = unserialize($row->node_data_field_image_field_image_data); ?>
<?php if ($data['title']): ?>
  <?php print $data['title']; ?>
<?php endif; ?>
Anonymous’s picture

Title: some characters not displaying correctly » Characters displayed as HTML entities in Views
Component: Miscellaneous » Code
Priority: Minor » Normal

I've also just come across this. I can confirm that apostrophes in my title text are being displayed as &#039; in my view, but not in the node itself.

This leads me to think it's an issue with the Views implementation, but since this module doesn't have any Views code, I think it might be in the Filefield module...

jaarong’s picture

Any updates on this? I just discovered this issue on my site. It must have come from a recent update, because I don't think this has always been happening.

pomliane’s picture

Same issue with ImageField descriptions provided by ImageField Tokens and unable to clearly find the responsible module so... subscribing here too.
The problem appears both in Views and in node view with this particular description field.

dunx’s picture

Checking "Enable custom title text" under "Title text settings", I can enter "Picture &copy; Me" as the title of an uploaded image, but this is displayed as "Picture &copy; Me" on the title tag on the full node, rather than "Picture © Me".

As an aside, I'm also using Lightbox2 and the copyright symbol displays as expected as the title underneath the image.

On the teaser, I have a cropped image linking to the full node. That too has "Picture &copy; Me". Probably a separate issue, but can you override that title to be "Click for full item"? Is that themeing?

TimeBandit’s picture

Thanks, #6 helped me. Use print_r($row) to see the name of your field that should replace "node_data_field_image_field_image_data"

ayalon’s picture

I have the same problem. I did it with a php custom field. Waiting for a real solutions. Can easily be reproduced. Just outbut the image description with an apostophe in a view.

amogiz’s picture

Subscribing.

Please could you tell me the "syntax" to write the title in a php custom field ?
I could not find.

stolzenhain’s picture

Subscribing. Also, because I had some trouble understanding the fix, here's how got it to work the least intrusive via views templates for this field only (replace MYFIELDNAME with the system name of your imagefield):

  1. Generated a file called views-view-field--field-MYFIELDNAME-data.tpl.php
  2. replaced the regular <?php print $output; ?> with the code shown in #6:
  3. <?php $data = unserialize($row->node_data_field_MYFIELDNAME_field_MYFIELDNAME_data); ?>
    <?php if ($data['title']): ?>
    <?php print $data['title']; ?>
    <?php endif; ?>
  4. updated templates information in views
  5. when outputting the view (not in the views preview!) the characters are again escaped correctly
quicksketch’s picture

Status: Active » Fixed

This has been fixed in FileField's views handling (thus fixing ImageField): #1018850: Views file data description shows encoded characters

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.