I have a content type with two fields: Exterior Images and Interior Images
Both of these fields are Unlimited Values – so the user can upload as many images as they want to exterior and interior. Screenshots: http://prntscr.com/a9m8o5 http://prntscr.com/a9m8uc
Now I’m trying to create a view that grabs all exterior and interior images uploaded and displays them.
The only way I can find to have each image displayed as its own individual field and row is to perform a UNION betwen something like SELECT exterior UNION SELECT interior etc. etc. but I just can’t seem to figure out the rest.
I’ve tried creating two views and combining them like this:
function pgallery_views_pre_execute(view &$view){ if ($view->name == 'photo_gallery'&& $view->current_display == 'page_1') { // View 1 contains Interior Images $view1 = views_get_view('photo_gallery'); $view1->build('block_1'); $query1 = $view1->build_info['query']; // View 2 contains Exterior Images $view2 = views_get_view('photo_gallery'); $view2->build('block_2'); $query2 = $view2->build_info['query']; $query1->union($query2); $view->build_info['query'] = $query1; } }
but it won’t render whatever is in $query2 – it just repeats $query1 values. So I get the correct number of “rows” from the result but it repeats the data for some reason. Please help!