6

Using Views with Drupal 7, how can I use the content path to sort a result table?

I have node title, created date and path as fields for a view. The first two fields have the checkbox to make them sorting options in the display settings, but the node path field doesn't.

  • 3
    Are you trying to sort by node path, i.e. node/123, node/124, or by URL aliases, i.e. content/page-title-one, content/page-title-two? – Charlie Schliesser Nov 29 '12 at 18:19
  • good question ;) by url aliases – Gueno Nov 30 '12 at 9:29
  • 3
    Well, a quick Google search turned up drupal.org/project/views_url_alias. Probably URL aliases do not have Views sort handlers included in Views 7.x. It would be trivial to write one, so hopefully this module has already done so. – Charlie Schliesser Nov 30 '12 at 16:00
0

Node path is not a field from DB table. It is calculated dynamically.

In views you can only sort if a sorting can be applied to the underlying SQL query.

0

If I understand well, you want get results with URL. So you can follow screens to do that.

enter image description here

enter image description here

0

It's not possible to sort on something that isn't a DB field. Instead, you have to associate it with something else that is sortable. For example, if your URL aliases map to the node's NID, you could put them both in the same column, exclude the NID from the view, and sort on that.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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