Taxonomy Easy Filter
Categories
Component ID
Component name
Component type
Component security advisory coverage
Downloads
Component created
Component changed
Component body
The taxonomy_ezfilter module is designed to give user a easy way to narrow listings with 1 or 2 level dropdown selections.
example:
We have some node types (such as blog, image, forum...) which have their own terms and are assoiciated a country/city vocabulary to maintain geographical information of nodes.
The site adminitstrator can select taxonomy_ezfilter module to use the country/city vocabulary to filter which node types in settings page. Then users will find a "[country][city](Go)" drop-down selections in selected node type's page. Users can filter contents on these page with the drop-down selections.
This module can filter any vocabulary with any other vocabulary. but now it support choose ONLY one filter vocabulary for whole site.
This module looks like taxonomy_filter, but there're many differences:
1. This module is easy to set by administrator, and user friendly by a drop-down selection filter.
2. This module process inheriting relations of terms in filter vocabulary automaticly.
3. This module works with sql_rewrite hook interface, though taxonomy_filter works with menu hook. So this module can perform in any page supporting sql_rewrite interface, such as forum/$tid or image/$tid, etc, and you don't need to change any url of your site. This module try to handle node lists in these page tansparently and smartly. Taxonomy_filter depend on its url specifically.
4. This module trace users filter setting in their session, so they set filter once, it works for them on related pages automaticly.
Note:This module won't change anything in the database; it just handle sql_rewrite hook to process view's SQLs.
Usage:
1. Install and active this module in common way.
2. Add a vocabulary for filter working. This vocabulary can be simple, or multi-levels. Assign it to node type what you want to filter.
3. In administrator's settings page, Set "EzFilter Vocabulary" to the vocabulary in step 2. You can configure level's title in "Define filter level" fields, such like level 1 title is "country" and level 2 title is "city". In "Define filtered type" fieldset, you can choice which types of node will be filtered. Only types assigned in step 2 will be listed here.
4. Done. Browsing pages of nodes which are your selected types, you will see a filter.
PS: When user change level 1 item, Level 2 selection will be filled by javascript automaticlly. If client is not support javascript, this module is still WORK. When user select level 1 item, he can submit firstly, then he will get correct selections in level 2 box -- Just need an additionally submit.
功能有些类似taxonomy filter,但是目的和实现完全ä¸åŒã€‚这个模å—用æ¥å¤„ç†å¦‚下类似的情况:
例如,我们站上有一些节点类型(如blog, 图片,论å›ï¼‰ï¼Œè¿™äº›èŠ‚ç‚¹æœ‰è‡ªå·±çš„æœ¯è¯è¡¨å’Œæœ¯è¯è¿›è¡Œåˆ†ç±»ã€‚å¦å¤–,这些节点还与å¦ä¸€ä¸ªâ€œå›½å®¶/åŸŽå¸‚â€æœ¯è¯è¡¨ç›¸å…³è”。则我们å¯ä»¥ä½¿ç”¨è¿™ä¸ªæ¨¡å—,åªéœ€é…ç½®æ¤æ¨¡å—使用“国家/åŸŽå¸‚â€æœ¯è¯è¡¨è¿‡æ»¤æŒ‡å®šç±»åž‹çš„节点,用户就会在那些节点的页é¢ä¸Šçœ‹åˆ°ä¸€ä¸ªå½¢å¦‚“[country][city](Go) â€çš„下拉选择器,用户å¯ä»¥åœ¨è¿™äº›é¡µé¢ä¸Šå¿«é€Ÿè¿‡æ»¤é¡µé¢ä¸çš„内容。并且“国家/åŸŽå¸‚â€æ˜¯ç»§æ‰¿å…³ç³»ï¼Œä¾‹å¦‚仅选择术è¯â€œä¸å›½â€ï¼Œåˆ™æ˜¾ç¤ºä¼šåŒ…括“ä¸å›½â€æœ¯è¯ä¸‹çš„æ‰€æœ‰å级城市。
这个过滤术è¯è¡¨å¯ä»¥æ˜¯ä»»ä½•ä½ éœ€è¦çš„æ ·å和内容,å¯ä»¥åªæœ‰ä¸€çº§ï¼Œä¹Ÿå¯ä»¥æœ‰å¤šçº§ï¼Œä½†æ˜¯ç”¨æˆ·çš„é€‰æ‹©æ¡†åªæœ‰ä¸¤çº§ã€‚在多级情形,用户选择两级过滤时的结果里包å«äº†ç¬¬äºŒçº§åŠå…¶æ‰€æœ‰çš„å级。但当å‰ä»…仅支æŒå¯¹å†…容使用一个过滤术è¯è¡¨ã€‚
注æ„:这个模å—ä¸ä¼šæ”¹å˜æ•°æ®åº“ä¸çš„任何数æ®å†…å®¹â€”â€”é™¤äº†å®ƒè‡ªå·±çš„å‡ ä¸ªé…ç½®å˜é‡ã€‚å®ƒåªæ˜¯é€šè¿‡sql_rewrite hook处ç†é¡µé¢çš„æ˜¾ç¤ºè€Œå·²ã€‚
与taxonomy_filter模å—的区别:
1ã€è¿™ä¸ªæ¨¡å—å¯ä»¥ç”±ç®¡ç†å‘˜è½»æ¾è®¾ç½®ï¼Œé€šè¿‡é¡µé¢è‡ªåŠ¨æ·»åŠ çš„ä¸‹æ‹‰é€‰æ‹©æ¡†ä½¿å…¶æ˜“äºŽç”¨æˆ·ä½¿ç”¨ã€‚
2ã€è¿™ä¸ªæ¨¡å—å¯ä»¥è‡ªåЍ处ç†è¿‡æ»¤æœ¯è¯è¡¨çš„æœ¯è¯ä¹‹é—´çš„继承关系,对“国家/城市/城区â€ä¹‹ç±»çš„大å°ç»§æ‰¿å…³ç³»ç‰¹åˆ«æœ‰ç”¨ã€‚
3ã€è¿™ä¸ªæ¨¡å—实现上是使用sql_rewrite hook接å£ï¼Œè€Œtaxonomy_filter使用èœå•调用接å£ã€‚å› æ¤è¿™ä¸ªæ¨¡å—å¯ä»¥åœ¨ä»»ä½•支æŒsql_rewrite hook调用的sqlè¯å¥ç”Ÿæˆçš„页é¢ä¸Šå·¥ä½œï¼Œä¾‹å¦‚forum/$tid,image/$tidç‰ç‰ï¼Œä½ ä¸ç”¨æ”¹å˜ç«™ç‚¹åŽŸæ¥çš„任何url。这个模å—è¯•å›¾é€æ˜Žå’Œæ™ºèƒ½çš„处ç†å¯¹é¡µé¢çš„node/list的过滤。而taxonomy_filter则必须基于特定的urlæ¥å·¥ä½œã€‚
4ã€è¿™ä¸ªæ¨¡å—在sessionä¸è®°å½•ç”¨æˆ·çš„è¿‡æ»¤é€‰æ‹©ï¼Œå› æ¤ç”¨æˆ·é€‰æ‹©ä¸€æ¬¡å°±å¯ä»¥åœ¨é¡µé¢è·³è½¬ä¹‹é—´ä»ç„¶ä¿æŒè‡ªå·±çš„è¿‡æ»¤é€‰æ‹©ï¼Œå¦‚æžœä½ é™åˆ¶ç”¨æˆ·åªæœ‰ä¸€ä¸ªsession,那么用户会å‘çŽ°ç«™ç‚¹å§‹ç»ˆä¿æŒä»–的过滤选择。当然,用户也å¯ä»¥ä½¿ç”¨ä¸‹æ‹‰é€‰æ‹©æ¡†è½»æ˜“改å˜è‡ªå·±çš„é€‰æ‹©ä¼šå–æ¶ˆè¿‡æ»¤ã€‚
使用方法::
1ã€é€šå¸¸æ–¹å¼å®‰è£…和激活taxonomy_ezfilter模å—
2ã€æŒ‰é€šå¸¸çš„æ–¹å¼ä¸ºnode type建立术è¯è¡¨ã€‚åŒæ—¶å»ºä¸€ä¸ªè¿‡æ»¤æœ¯è¯è¡¨ï¼Œä¾‹å¦‚“国家/城市â€çš„结构,å¯ä»¥å•级结构,也å¯ä»¥å¤šçº§ç»“æž„ï¼Œè¦æ±‚必选。
è¿™æ ·ç”¨æˆ·å‘å¸ƒå¸–åæ—¶é™¤äº†é€šå¸¸çš„æœ¯è¯é€‰æ‹©æˆ–freetagging之外,还必须选择一个“国家/城市â€ä¿¡æ¯ã€‚
3ã€åœ¨taxonomu_ezfilter设置ä¸â€œEzFilter Vocabularyâ€é€‰æ‹©ç¬¬1æ¥ä¸è®¾ç½®çš„过滤术è¯è¡¨ã€‚
“Define filter levelâ€ä¸è®¾å®šç¬¬ä¸€å’Œç¬¬äºŒçº§çš„æ ‡é¢˜ï¼Œä¾‹å¦‚第一级å«â€œå›½å®¶â€ï¼Œç¬¬äºŒçº§å«â€œåŸŽå¸‚â€ï¼Œè¿™ä¸¤ä¸ªåç§°ä¼šæ˜¾ç¤ºåœ¨ä¸‹æ‹‰é€‰æ‹©æ¡†é‡Œï¼Œè¿™æ ·ç”¨æˆ·æ‰çŸ¥é“自己在选什么。
在“Define filtered typeâ€ä¸å‹¾é€‰è¦è¿‡æ»¤å“ªäº›ç±»åž‹çš„节点,注æ„åªæœ‰ä¸Žè¿‡æ»¤æœ¯è¯è¡¨ç›¸å…³è”的节点类型æ‰ä¼šåˆ—出æ¥ï¼Œå¦‚æžœè¿™é‡Œä»€ä¹ˆä¹Ÿæ²¡æœ‰ï¼Œè¯·ä¿®æ”¹ä½ çš„è¿‡æ»¤æœ¯è¯è¡¨çš„å…³è”节点类型。
4ã€æµè§ˆæŒ‡å®šè¿‡æ»¤çš„节点类型的页é¢ï¼Œä½ 会看到过滤选择框了。
注æ„:通常情况下,切æ¢ä¸€çº§é€‰æ‹©æ¡†æ—¶ä¼šç”±Javascript填充第二级选择框的å¯é€‰é¡¹ï¼Œä½†æ˜¯ï¼Œå½“å®¢æˆ·ç«¯ä¸æ”¯æŒJavascriptæ—¶æ¤æ¨¡å—åŒæ ·èƒ½å·¥ä½œã€‚æ¤æ—¶å…ˆé€‰æ‹©ç¬¬ä¸€çº§æäº¤ï¼Œç„¶åŽå°±å¯ä»¥é€‰æ‹©ç¬¬äºŒçº§äº†â€”â€”éœ€è¦æäº¤ä¸¤æ¬¡ã€‚