DRUPAL block path setup bug

zhaozj2021-02-16  68

The DRUPAL block path settings, the purpose is to display different blocks (Block) on different page nodes, and a column name is PATH in the block settings of the control panel, which is it. See: Putting Blocks with Content in the sidebars

I have studied, unregistered, and recently asked this question in the official forum of Drupal, then I found this: Block paths and path aliases, proved that the 4.4.0 version does not use the Clean URL, Block path has bugs, killes @ www.drop.org gives this Patch:

Category: Feature Requests? Bug reportsigned to: anonymous? Killes@www.drop.orgstatus: Active? Patchattachment: block.patch (922 bytes)

In fact, I found it in block.module.

Delete: IF ($ Block ['Status'] && (! $ Usr-> uid ||! $ Block ['Custom']) || ($ Block ['Custom'] && $ User-> Block [ $ Block ['Module']] [$ block ['delta']]) && (! $ block ['Path'] || preg_match ($ block ['Path'], "/". $ _get ["q "])))) {

Add: IF ($ Block ['Status'] && (! $ Usr-> uid ||! $ Block ['Custom']) || ($ Block ['Custom'] && $ USER-> Block [ $ Block ['Module']] [$ block ['delta']]) && (! $ block ['Path'] || preg_match ($ block ['Path'], "/". $ _get ["q "]) || preg_match ($ block ['PATH'], STR_REPLACE ('? q =', '/', request_uri ())))) {

Specific expression example:

Only display <(/ | index / .php) $> on the homepage

Only in the node under? Q = blog display <^ // blog>

Only display <^ // blog | (/|Index/.php) $> on the homepage and? Q= blog node

Only display <^ // node / view> in the detailed node

The rest of the sympathy, can be replaced with the node.

The expression described above is only for DrupAl4.4, and the previous version is slightly different, see Putting Blocks with Content in the sidebars, have fun!

转载请注明原文地址:https://www.9cbs.com/read-17279.html

New Post(0)