开发者

Drupal 7 : Filter Content based on Content types

开发者 https://www.devze.com 2023-04-02 11:29 出处:网络
How do i create a dropdown box with all the conten开发者_如何学Pythont types which filter out the data on page.tpl.php. Even if I create a dropdown box myself filled with the content types , how would

How do i create a dropdown box with all the conten开发者_如何学Pythont types which filter out the data on page.tpl.php. Even if I create a dropdown box myself filled with the content types , how would I able to write a functionality to filter nodes based on selected content type ?


You should check out the Views module you can use parameters passed via the url to filter data. You can generate a drop-down box using forEach in PHP using data fetched by using hooks. After that you should be able to pass the parameters to a views page and get what you are looking for.


  1. contextual filter
  2. When the filter value is NOT available
  3. Provide default value
  4. PHP Code
  5. if ($node = menu_get_object()) { return $node->type; }

  6. apply

  7. rejoice
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号