Drupal 7 : Filter Content based on Content types
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.
- contextual filter
- When the filter value is NOT available
- Provide default value
- PHP Code
if ($node = menu_get_object()) { return $node->type; }
apply
- rejoice
精彩评论