In need of more PHP help..again

glew

Junior Member
Joined
Feb 10, 2008
Messages
141
Reaction score
95
I figured out my last problem on my own, but now i've ran into another one.

i'm trying to put this code
Code:
<div style="float:left; margin-right: 5px"><img src="<?php $key="fav"; echo get_post_meta($post->ID, $key, true); ?>" /></div>

next to the <li> tag here
Code:
print "<li>***code here***<a href='". get_permalink($post->id) ."'>".$post->post_title."</a></li>\n";

it's the code for custom field image and i want each image to show up next to each title.

if someone could help with a solution i would be really greatful :(
 
Can't really get into a CSS lesson on how it should be done, but a quick fix would be to remove the DIV tag and add a few spaces, which are  



Code:
print "<li><img src="<?php $key="fav"; echo get_post_meta($post->ID, $key, true); ?>" />   <a href='". get_permalink($post->id) ."'>".$post->post_title."</a></li>\n";
 
thanks for the reply detox, but didn't work. Your code is not escaped properly. The image can't show up that way.
 
So escape it...????

Code:
<?php 

$key="fav"; 
$varImage = get_post_meta($post->ID, $key, true); 

print "<li><img src=\"". $varImage ."\" />   <a href='". get_permalink($post->id) ."'>".$post->post_title."</a></li>\n";

?>
 
Detox you are a god :champion: and I am an idiot :rocketwho

I was echoing $key instead of $varimage!

Thanks brotha you are a lifesaver :whee:
 
Back
Top