Hi,

I am using Monthly Archive, Tag Cloud modules in my blog pages. I want to show these blocks in
Main Blog page,
Archive Pages,
Taxonomy Pages,
Node pages,
single blog pages.

I can't give this list in Block settings. Because each and every entry come with some numerics.
So is there any possiblities to give wild card or regular expression for this?
(like., blog/ , node/, taxonomy/terms/, archive/)

Thanks in advance.

Comments

SweeneyTodd’s picture

Yes you can use wild card settings e.g blog/*

This is in the instructions on the block settings page next to the textfield you input the data in.

nagarajanl’s picture

There is a 'Page specific visibility settings' in the Blocks Administration where you can specify the visibility of blocks (you can also specify wildcard characters there) like node/*, blog/* etc...

sanjanaa’s picture

Hi thanks for your timely help.

That working fine.

sanjanaa’s picture

Hi,

I am facing another one problem in this too. Your solution is working fine for me. But at the same time, I don't want to show that blocks in Site Pages.

I am using node/* for, to show that particular blocks in single blog entry pages, which url should be
www.example.com/?q=node/123

Similarly, all pages url should be www.example.com/?q=node/100.

So, if i am using node/* in block settings it is showing in all pages too. How to avoid this?

Thanks in advance.

nevets’s picture

If you only want the block to show for blog entries and not other content types you will need to use PHP code, something like

$node = menu_get_object();
if ( !emtpy($node) && $node->type == 'blog' ) {
  return TRUE;
}
else {
  return FALSE;
}
sanjanaa’s picture

Thanks for your reply nevets.

But I want to show that particular block in

blog
blog/*
archive/*
taxonomy/term/*

and single blog entry pages.

How can I do this?

Thanks in advance...

SweeneyTodd’s picture

Would it be easier to say which pages you do not want to show the block? You can set it all so that the block is listed in all pages EXCEPT the ones listed.

sanjanaa’s picture

No SweeneyTodd.

It is not that much easy. Beause I can't give all those pages which are not required that block. Then I have to mention all pages, Editable pages, creation pages and so on.

I think that may be difficult to mention.

SweeneyTodd’s picture

Some of the pages will be easy to catch (e.g. admin/*). I am not sure whether the wildcard will work at the beginning of a path (e.g. */edit/*).

Does it matter is a block is visible only on pages you will see, or is this site to be delivered to a third-party?

The other options are:
1) use php to check the path and come up with a more comprehensive set of rules about where to / not to show the menu,
2) use the rules to say which pages the block should be displayed on and use css to hide it on the exceptions (if there are only a couple of these),
3) check out the modules others have suggested,
4) I am not sure whether using Panels for your layout will mean syou have more control over whether the block is visible. I have not tried complex rules in Panels.

nevets’s picture

How about

<?php
$node = menu_get_object();
if ( !empty($node) && $node->type == 'blog' ) {
  return TRUE;
}
else {
  $show_on = array('blog', 'blog/*', 'archive/*', 'taxonomy/term/*');
  $pages = implode("\n", $show_on);
  $path = drupal_get_path_alias($_GET['q']);
  // Compare with the internal and path alias (if any).
  $page_match = drupal_match_path($path, $pages);
  if ($path != $_GET['q']) {
    $page_match = $page_match || drupal_match_path($_GET['q'], $pages);
  }

  return $page_match;
}
?>

[Changed call to emtpy() to empty()]

sanjanaa’s picture

Hi nevets,

Thank you so much for your reply. But that php code shows that block in each and every page (admin/edit/my account....) except the login page. But my need is to show in single blog entry page.

(blog
blog/*
archive/*
taxonomy/term/*
and single blog entry pages.)

I don't know why this work like this? Can you please help?

Thanks in advance.

nevets’s picture

Three thoughts

a) Bad function call, fixed in post above

b) You need the <?php and ?> tags, added to post above

c) For block visibility you want to select "Show if the following PHP code returns TRUE (PHP-mode, experts only)."

sanjanaa’s picture

Yes Yes Yes.................

Thats works fine now. THANKS THANKS THANKS A Lottttttttttttttttttttt nevets.

combicart’s picture

You can also use the Context module for this purpose: http://drupal.org/project/context

WorldFallz’s picture

In the future please don't post duplicate threads-- there was no reason to start a new thread when you already had people helping you in another thread.

(cross reference: http://drupal.org/node/913250)