Home » Topics » Pods 1.x » img src=”Array” ?
img src=”Array” ?
This topic contains 9 replies, has 4 voices, and was last updated by hsatterwhite 2 years, 2 months ago.
-
AuthorPosts
-
March 1, 2011 at 10:58 pm #165292
I’m trying to display an image I setup in my pod as a File Upload.In my code, I use:
1<img src="<?php echo $artists_videoimg; ?>" alt="Image" title="Image" />But that doesn’t seem to work well. I don’t get the image in my template and the code says img src="Array" instead of the actual name of the image. Don’t understand why since I’ve used this previously on other sites without an issue. Any clue where I went wrong?
March 2, 2011 at 1:28 am #165293<img src="<?php echo $artists_videoimg[0]; ?>" alt="Image" title="Image" />
March 2, 2011 at 6:52 pm #165294That didn’t work. I’m still not receiving an image.
March 2, 2011 at 6:54 pm #165295March 3, 2011 at 10:30 am #165296March 3, 2011 at 7:33 pm #165297Well, I tried the print approach owi suggested but all I got was:
<p>Array</p>
Which isn’t what I wanted and now makes me wonder if the file uploaded at all. Problem is I currently can’t access the database because web.com changed the password on my clients’ control panel so currently I can’t login. Obviously, I’ll have to get back to you on this issue once I can access the DB.March 3, 2011 at 11:55 pm #165298OK, I have an update. Seems that even though I defined a variable called video_img in my pod, it’s not showing as a field for that same pod in the database.It does show up in the wp_pod_fields table so this is kind of unexplainable. Why would that be happening? Only reason I can think of is because there’s an underscore in it.
March 4, 2011 at 8:24 am #165299<?php
$artists_videoimg = $Pod->get_field(‘imgfieldname.guid’);
?>
Your image url is : <?php print_r($artists_videoimg); ?><br /><img src="<?php echo $artists_videoimg[0]; ?>" alt="Image" title="Image" />
It doesn’t appear in the db table because it’s a related field. And uses the same schema as any media element in WP.
Nothing is wrong check your php code.March 4, 2011 at 7:08 pm #165300It’s not a related field. At least it shouldn’t be. It’s just a field as part of the overall pod. I have another File Upload field and the data shows up from that. So this makes no sense. The rest of my PHP is good. This is the only issue. All other data from this pod appears. If I use gr0b1′s code from the previous post, it just stops my HTML in its’ tracks.
I posted the PHP code on PasteBin for the entire page. So maybe there’s a clue there:
March 14, 2011 at 12:41 am #165301You need to use the machine name as defined the for the file upload column in your Pod. Owi had it right with his posted code.
I looked at your paste bin and it seems like instead of using video_img as you referenced previously you’re using videoimg in your get_field call.
-
AuthorPosts
You must be logged in to reply to this topic.