0

I have a node type that references other nodes. When viewing node of Content Type A, I have set up a view that displays all references to nodes of Content Type B on a gmap.

This is the code from a template file that overrides the display of view_one; it calls the map in from another view.

<?php
  $view = views_get_view('view_one');
  $view->set_arguments(array($fields['nid']->raw));
  $view->execute();
  $contents = $view->result;

  foreach($contents as $content) {
    $nodes[] = $content->node_field_data_field_B_content_nid;
  }

  if (isset($nodes)) {
    $args = implode(',' , $nodes);
    $view = views_get_view('linked_map');
    $view->set_display('map');
    $view->set_arguments(array($args));
    $view->execute();

    $markup_map = $view->render($args);

  }
  else {
    $markup_map = '';
  }
?>

It displays beautifully. The only problem is I want to use numbered markers, so that the list is in the same order as the referenced nodes in the main view ("view_one"). Is there some way that I can either utilize a "sort" that won't rearrange the list, or write a custom sort that will preserve the existing order?

I am using the Views module version 7.x-3.1.

2
  • what order is it finally being displayed in?
    – Jimajamma
    Apr 4, 2012 at 14:44
  • It is displaying by date created I believe, just as a default if I remove all sorting criteria Apr 6, 2012 at 19:23

1 Answer 1

1

Draggable Views will let you define your own manual sort, and keep it consistent across different displays.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.