By Yucom on
Hi there,
I created a new content type with CCK. There's a select list in it with 5 options, lets call them a to e. I also themed the node, and placed the list by hand print $node->content['field_news_category']['#value'] in it.
What I now want to do is, I don't want drupal to display the words, but images instead of it. Which should look like this:
a = image1
b = image2
c = image3
etc
Is there any way to do so? Or is there a way to replace explicit words by an image. I tryed wordfilter, but it did not reacted in any way...
Thanks for your help in advance,
Yucom
P.s.: I don't have any knowledge in php, so pleace be considerate. :)
Comments
that's not the right way to solve this problem...
You do not "want to replace text with images" - you want to display one of 5 images, depending upon which checkbox(es) you select in your custom node type.
You would find the whole thing easier to manage and theme if you used Drupal taxonomy, and the taxonomy_image module.
Instead of having a check box for your terms A, B, C, D, E or whatever, create a vocabulary, make it mandatory for this node type, and use the taxonomy image module to display the relevant image.
This approach will be much more flexible, and much easier to maintain.
http://drupal.org/project/taxonomy_image
However, if you insist on doing this the dirty way, you could do this from your theme. Simply wrap your theme output in an html img tag to display an image of the same name:
This would display a.jpg, b.jpg, c.jpg, d.jpg, e.jpg, or whatever if you put the images in your /files folder
I stress however, that this is a horrible way of doing it! Very much against the Drupal philosophy!