0

I have two content types:

  • news
  • review

I have a taxonomy vocabulary attached to them with following terms

  • tech
  • entertainment
  • other
  • (More may come)

I need to have a listing of these contents in following format:

  • tech/news (or news/tech)
  • tech/reviews (or reviews/tech)
  • other/news (or other/news)
  • other/reviews (or other/reviews)

..and so on.

I could create a page for every required URL pattern and create a separate view for each. But is there any dynamic way to do it in views?

At least, can I add a drop down filter for content type on term pages?

I'm using Drupal 6.

Thanks for any help. :)

  • why don't you use one vocabulary? – xurshid29 Dec 17 '13 at 6:25
  • It's one vocabulary only with multiple terms in it. and for content types i need multiple content types to theme differently. – Eez Dec 17 '13 at 10:24
0

I think you can do something like this:

  1. Create one page view and give him a path like: %/%
  2. Add contextual filters
  3. Create a module
  4. Implement hook_menu.

..

function test_menu() {
  $items['test/%term_name/%node_type_name'] = array(
    'title' => 'My test page',
    'page callback' => 'test_page_callback',
    'access callback' => TRUE,
    'page arguments' => array(1,2),
    'type' => MENU_NORMAL_ITEM,
  );

  return $items;
}

function test_page_callback($term_name, $node_type_name) {

  /**
   * here we are getting arguments from _to_arg() functions and processing them to
   * get $tid and $SECOND_ARGUMENT
   */

  return render(views_embed_view('test_veiw', 'test_display', $tid, $SECOND_ARGUMENT));
}

function term_name_to_arg() {
  // return term_name as argument
}


function node_type_name_to_arg() {
// return node_type_name as argument
}
| improve this answer | |

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.