5

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
  • 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? Commented Nov 29, 2012 at 18:19
  • good question ;) by url aliases
    – Gueno
    Commented Nov 30, 2012 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. Commented Nov 30, 2012 at 16:00

3 Answers 3

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 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.