By jniesen on
I have a view that has two fields in it. One of the fields is the path to an image. When I run the Live Preview in the view's admin section it spits out the image path correctly:
Nid: 39
Image: sites/default/files/brand/brand_pepsi.gif
Nid: 25
Image: sites/default/files/brand/brand_dunkin.gif
When I try to render the view on the site, the nid appears correctly, but the filepath does not. I know I could load the noad
based on the nid, but would like to avoid doing that if I can. Here's the code:
$view = views_get_view('BrandAllianceHome');
$view->render();
foreach ($view->result as $result) {
echo $result->nid; // this outputs the nid correctly
echo $result->$field_imgpath; // not working
}
Any help is appreciated
Thanks