0

I'm using the drupal administrator menu for the settings there i have a page called /desert/234234 the block should appear only when the url is /desert/(desert_id) how can i restrict that

3

In Drupal 7 you can use PHP code in the block's "Visibility settings."

Steps

  • Go to admin/modules and enable the PHP filter module

    enter image description here

  • Go to admin/structure/block and click on "Configure"

    enter image description here

    • Enter the following PHP code (including <?php and ?>) in the Page settings.

    enter image description here

| improve this answer | |
0

Drupal 7: 1. Go to: /admin/structure/block 2. Click configure 3. In Visibility settings set "Only the listed pages" and in textarea below insert " /desert/* .

Also remember to activate block - put it in one of regions of the page.

| improve this answer | |
  • i can do if it is a static page like desert/xxxxx but my url is desert/id. here id is an dynamic content – Ajmal Aug 13 '13 at 8:38
  • Wildcard () replaces all characters. So url like /desert/ is equal to /desert/123456, /desert/abcdef, /desert/cake/apple and so on. – majkelch Aug 13 '13 at 8:59
  • let me explain in clear. i'm having two pages desert/(13221)dynamic value and desert/continent. The block should not display in desert/continent page. how can i restrict? – Ajmal Aug 13 '13 at 12:16
  • Then in the same tab you should switch to "Pages on which this PHP code returns TRUE (experts only)" and write some PHP Read this for more help on this topic. Or you can write your custom module and use hook_block_info_alter. – majkelch Aug 13 '13 at 12:45
0

Make a block appear only when URL is something: On the configuration page of the block go to Visibility settings -> Pages -> Show block on specific pages, and select "Only the listed pages." Wildcards may be used if needed; for example, desert/* would match any path starting with desert/.

| improve this answer | |
  • i can do if it is a static page like desert/xxxxx but my url is desert/id. here id is an dynamic content – Ajmal Aug 13 '13 at 8:38

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.