MarthaD Posted February 23, 2007 Posted February 23, 2007 I have installed the movie details contrib which works fine. It does a few things i dont like tho - including showing a dhtml tool tip of a missing image when no image is uploaded for an actor or director. What i need to do is exclude the tooltip if no image is found in the database. So presently the code is this: if (tep_db_num_rows($actor_query) > 0){ echo TEXT_ACTOR; $coma = 1; while ($actor = tep_db_fetch_array($actor_query)){ echo '<a href="' . tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, 'people=' . $actor['people_id']) . '" onMouseOver="showWMTT('. $actor['people_id'] .')" onMouseOut="hideWMTT()" alt="' . TEXT_SEE_ALL_MOVIES . $actor['actor'] . '" title="' . TEXT_SEE_ALL_MOVIES . $actor['actor'] . '">' . $actor['actor'] . '</a>' . (($coma < tep_db_num_rows($actor_query)) ? ', ' : ''); echo '<div class="tooltip" id="'.$actor['people_id'].'"><img src="' . DIR_WS_IMAGES . $actor['picture'] . '" /></div>'; $coma++; } I think it should be if (tep_db_num_rows($actor_query) > 0 && tep_not_null($actor['picture']) ){ echo TEXT_ACTOR; $coma = 1; while ($actor = tep_db_fetch_array($actor_query)){ echo '<a href="' . tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, 'people=' . $actor['people_id']) . '" onMouseOver="showWMTT('. $actor['people_id'] .')" onMouseOut="hideWMTT()" alt="' . TEXT_SEE_ALL_MOVIES . $actor['actor'] . '" title="' . TEXT_SEE_ALL_MOVIES . $actor['actor'] . '">' . $actor['actor'] . '</a>' . (($coma < tep_db_num_rows($actor_query)) ? ', ' : ''); echo '<div class="tooltip" id="'.$actor['people_id'].'"><img src="' . DIR_WS_IMAGES . $actor['picture'] . '" /></div>'; $coma++; } echo '<br>'; } else { if (tep_db_num_rows($actor_query) > 0){ echo TEXT_ACTOR; $coma = 1; while ($actor = tep_db_fetch_array($actor_query)){ echo '<a href="' . tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, 'people=' . $actor['people_id']) . '" title="' . TEXT_SEE_ALL_MOVIES . $actor['actor'] . '">' . $actor['actor'] . '</a>' . (($coma < tep_db_num_rows($actor_query)) ? ', ' : ''); $coma++; } } echo '<br>'; } But it doesnt exclude the image tooltip from showing IF there is no image recoreded in the database... Can someone PLEASE help me with this....
Guest Posted February 23, 2007 Posted February 23, 2007 I have installed the movie details contrib which works fine. It does a few things i dont like tho - including showing a dhtml tool tip of a missing image when no image is uploaded for an actor or director. What i need to do is exclude the tooltip if no image is found in the database. So presently the code is this: if (tep_db_num_rows($actor_query) > 0){ echo TEXT_ACTOR; $coma = 1; while ($actor = tep_db_fetch_array($actor_query)){ echo '<a href="' . tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, 'people=' . $actor['people_id']) . '" onMouseOver="showWMTT('. $actor['people_id'] .')" onMouseOut="hideWMTT()" alt="' . TEXT_SEE_ALL_MOVIES . $actor['actor'] . '" title="' . TEXT_SEE_ALL_MOVIES . $actor['actor'] . '">' . $actor['actor'] . '</a>' . (($coma < tep_db_num_rows($actor_query)) ? ', ' : ''); echo '<div class="tooltip" id="'.$actor['people_id'].'"><img src="' . DIR_WS_IMAGES . $actor['picture'] . '" /></div>'; $coma++; } I think it should be if (tep_db_num_rows($actor_query) > 0 && tep_not_null($actor['picture']) ){ echo TEXT_ACTOR; $coma = 1; while ($actor = tep_db_fetch_array($actor_query)){ echo '<a href="' . tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, 'people=' . $actor['people_id']) . '" onMouseOver="showWMTT('. $actor['people_id'] .')" onMouseOut="hideWMTT()" alt="' . TEXT_SEE_ALL_MOVIES . $actor['actor'] . '" title="' . TEXT_SEE_ALL_MOVIES . $actor['actor'] . '">' . $actor['actor'] . '</a>' . (($coma < tep_db_num_rows($actor_query)) ? ', ' : ''); echo '<div class="tooltip" id="'.$actor['people_id'].'"><img src="' . DIR_WS_IMAGES . $actor['picture'] . '" /></div>'; $coma++; } echo '<br>'; } else { if (tep_db_num_rows($actor_query) > 0){ echo TEXT_ACTOR; $coma = 1; while ($actor = tep_db_fetch_array($actor_query)){ echo '<a href="' . tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, 'people=' . $actor['people_id']) . '" title="' . TEXT_SEE_ALL_MOVIES . $actor['actor'] . '">' . $actor['actor'] . '</a>' . (($coma < tep_db_num_rows($actor_query)) ? ', ' : ''); $coma++; } } echo '<br>'; } But it doesnt exclude the image tooltip from showing IF there is no image recoreded in the database... Can someone PLEASE help me with this.... I don't have all the code in front or, but it looks like you are checkiong for a paramter that deos not exist yet : if (tep_db_num_rows($actor_query) > 0 && tep_not_null($actor['picture']) ){ $actor['picture'] is not created until you are inside the while loop. You need to put your condition inside the while something like this : if (tep_db_num_rows($actor_query) > 0 ){ echo TEXT_ACTOR; $coma = 1; while ($actor = tep_db_fetch_array($actor_query)) { echo '<a href="' . tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, 'people=' . $actor['people_id']) . '" onMouseOver="showWMTT('. $actor['people_id'] .')" onMouseOut="hideWMTT()" alt="' . TEXT_SEE_ALL_MOVIES . $actor['actor'] . '" title="' . TEXT_SEE_ALL_MOVIES . $actor['actor'] . '">' . $actor['actor'] . '</a>' . (($coma < tep_db_num_rows($actor_query)) ? ', ' : ''); if tep_not_null($actor['picture']) { echo '<div class="tooltip" id="'.$actor['people_id'].'"><img src="' . DIR_WS_IMAGES . $actor['picture'] . '" /></div>'; } } // end while } else { Corrina
MarthaD Posted February 24, 2007 Author Posted February 24, 2007 Thank you. However, the line "if tep_not_null($actor['picture']) {" creates an error: Parse error: parse error, unexpected T_STRING, expecting '(' Any suggestions?
MarthaD Posted February 24, 2007 Author Posted February 24, 2007 I figured it out: "if (tep_not_null($actor['picture'])) {" Also no else statement is required as we simply do nothing if no image is found. THANK YOU Corrina for the kick in the right direction!!!!
Recommended Posts
Archived
This topic is now archived and is closed to further replies.