1

I have a view with arguments in the page and attachment displays.

When I go to the view page, I see a list of arguments (links) because in "Action to take if argument is not present" I selected "Summary, sorted ascending."

How do I sort arguments (in this case is term) by weight? I don't see any option to do this. Where can I change the query "ORDER BY term ASC" to "ORDER BY weight ASC" in code?

When I click an argument, I have another page with a list of arguments again, because I have an attachment. How do I only show the argument name I have clicked?

1

you are using drupal 6, or drupal 7?

If I understand well your questions:

you can change the query used to generate view results (Order BY, Where, etc) using query_alter hook. here one example: Making a field sortable in Views

About weight of arguments, I think that you can control order of precedence in 'rearrange' option:

enter image description here

If your question is related with weight of taxonomy terms, in your View settings > Add sort criteria > Taxonomy: Weight seems will be useful to sort according weight of each term:

enter image description here

regarding shows argument clicked, you can get argument from the current url easily using arg() http://api.drupal.org/api/drupal/includes--bootstrap.inc/function/arg/7:

example URL: http://example.com/node/12345/edit

in this example

arg(0) is node

arg(1) is 12345

arg(2) is edit

here some experiences in Drupal forum to review, with or without using arg():

http://drupal.org/node/180589

http://drupal.org/node/283945

you can add a php code to get respective argument, for example using arg() in a view header or in a drupal php node/page/block:

<?php echo arg(0); ?> or <?php echo arg(1); ?> according your target argument.

I hope information be useful.

  • i use drupal 6. about "weight of arguments, I think that you can control order of precedence in 'rearrange' option:" i see one "taxonomy:term" no term list to sort. – user780 Oct 3 '11 at 4:49
  • 1
    I think that you can use query_alter hook to review if you can alter the query according your needs. here is some guidance about what is query_alter hook drupal.org/node/1029634 – cigotete Oct 3 '11 at 17:19
  • I have updated my answer with a comment about sorting results of your view, according weight of taxonomy terms. – cigotete Oct 3 '11 at 21:27
  • thank u but it sort nodes, not arguments. i want to sort arguments (in this case taxonomy term) order by term weight. – user780 Oct 4 '11 at 5:50
  • then query_alter will be useful for you. – cigotete Oct 4 '11 at 14:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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