Debugging an Image Gallery system
I know this has been around a few times, but I have come to the conclusion that I want to use Pods to manage my images over NextGEN as I really want to build it from the ground up to do specifically what I want. I know there is more work involved, but it will be a project I will keep adding features to.
That out of the way, I am having an issue with the pod_helper method. Below is an overview of my setup:
Pods named 'image' and 'gallery'. Multi-select/bidirectional file upload column named 'images'/'galleries'. I am using the image sizes package and am attempting to create a 'gallery grid' helper that will display the images linked in the 'images' column as a thumbnail grid.
Pods Template - gallery_detail:
<h1>{@name}</h1><div class="thumb_grid">{@images.wp_media, gallery_grid}</div>
Display Helper - gallery_grid:
<?php if ($value) { foreach ($value as $v) { echo ' <img src = " '.$v->pod_helper('image_thumbnail').' " /> '; } } ?>
I'm getting this error:
" Fatal error: Call to a member function pod_helper() on a non-object in /home/rhysl/public_html/wordpress/wp-content/plugins/pods/core/Pod.class.php(329) : eval()'d code on line 6 "
I have found some other threads in the forum, and read over the relevant pages in the user guide multiple times but cant seem to work it out. Can someone please help me out with the logic?
Thanks!
2 Answers
The "pod_helper" method needs to be called on a Pod object, which is $this within a helper, and the $value needs to be passed as the second parameter:
<?php if ($value) { foreach ($value as $v) { echo ' <img src = " '.$this->pod_helper('image_thumbnail',$v).' " /> '; } } ?>
EDIT: Was going about it all wrong anyway. should be using a template for the gallery_grid, and just pull in the thumb with the image_thumbnail helper.
oh right thanks for the clarification. I did try $this-> but must have doubted it when THIS issue cropped up:
It must be related to the use of the image_thumbnail helper and how it outputs the code, as the thumbnail url is not being pulled in, only empty <img> tags only being written. I assigned a variable to the output and then dumped it with var_dump($thumbnail) - it shows the output as this. As far as I can see I am manipulating the data correctly, the same way I am in my list template which is working fine using this:
<img src="{@cover_image.wp_media, image_thumbnail}" />
Thanks for your help.
edited Jun 28 '10 at 2:53


