Closed (fixed)
Project:
Taxonomy Image
Version:
5.x-1.1-beta1
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
12 Mar 2008 at 14:36 UTC
Updated:
29 Mar 2008 at 17:43 UTC
Hello,
I've been trying to figure out how to call a page's taxonomy image from another page (I'm using movie_db module to create a database and want it to include thumbnail images on the cast and crew pages, much like imdb).
This is the code where I'm trying to place the picture:
if($node->actors[0]) {
$actors = theme_mdb_movie_people($node->actors);
$output .= "<br>";
$output .= "<b><u>";
$output .= "Cast";
$output .= "</b></u>";
$output .= " <TR><TD>";
I WANT THE PICTURE HERE
$output .= "</TD><TD> <div class=\"label2\">". t('') ." </div><div class=\"content2\">". $actors ."</div> </TD>\n";
if($node->characters) {
$output .= " <TD><div class=\"label2\">". t('.....') ." </div></TD> <TD> <div class=\"content2\">". $node->characters ."</div> </TD>\n";
}
$output .= "</TR>";
}
No matter what I do (I am still learning php and Drupal as and when I can), I just can't seem to call the image from the page being refered - in this case $node->actors[0]['nid'].
Any help that you could give me would be so greatfully receieved - or even pointers in the direction - everything I try just seems to end up in an error or just a blank bit.
Many thanks,
Ian
Comments
Comment #1
nancydruSomething on the order of:
Oh, I reread the note and see that this is probably not what you want - it shows the taxonomy image for the node you're on.
So, you actually want the image associated with $node->actors[0]['nid']? Let's see...
You probably could combine that all into one statement, but it's a bit more readable this way.
Comment #2
ultimatedruid commentedThanks for the message, however the following error comes up:
user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-node WHERE nid=0' at line 1 query: SELECT tid from term-node WHERE nid=0 in /home/ltdbco/public_html/testing/includes/database.mysql.inc on line 172.
I've tried a few things, but still can't get it to work - any ideas?
Many thanks,
Ian
Comment #3
nancydruThat's telling me that "$node->actors[0]['nid']" is not right - it is zero or non-existent. When you find the correct way to reference the node, then you put that into the query.
Comment #4
ultimatedruid commentedUsing
It brings out the following error - slightly different:
user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-node WHERE nid=1' at line 1 query: SELECT tid from term-node WHERE nid=1 in /home/ltdbco/public_html/testing/includes/database.mysql.inc on line 172.
I've had a look but I don;t really understand - the nid= value always reads 1, when it should read different values...?
Sorry for my lack of knowledge!!! I just feel so close, but yet so far!!
Comment #5
nancydruYes, the nid value should change for each actor.
Comment #6
nancydruYes, you were close. I downloaded the module and found out it is "$node->actors[xx]->nid" where "xx" is the counter for each actor.
BTW, I'm not sure that Image Attach (part of Image) wouldn't be better for this application.
Comment #7
ultimatedruid commentedHello,
Thank you so much!!! It works - however, I did have to change the {term-node} into {term_node}. Thank you so much for your help!!!
I've been trying to get the same sort of assistance with other image modules, and spent hours on each one, but yours is the first that has worked (ultimately thanks to your assistance - that no one else would give). So thank you very much!!! It truely is mosules like this that make drupal so good!!!
Best wishes,
Ian
Comment #8
nancydruNot to toot my own horn, but you will probably get more attention from me than almost anyone else. I try to maintain my modules the way I want others to maintain theirs. I have taken on co-maintenance on several that weren't getting attention and that I wanted updated.
I'm glad it's working for you. I'd like to see the finished product when it's ready.
Comment #9
nancydru