Hello there,
I am not a programmer and I don't know about about php.
However I found a code that works very well for content type ( Thank you Vincent)

<?php
$match = FALSE;
$types = array('YOUR CONTENT TYPE HERE' => 1);
if (arg(0) == 'node' && is_numeric(arg(1))) {
  $nid = arg(1);
  $node = node_load(array('nid' => $nid));
  $type = $node->type;
  if (isset($types[$type])) {
    $match = TRUE;
  }
}
return $match;
?>

You can even add several separate node to this content type:

<?php
$match = FALSE;
$types = array('YOUR CONTENT TYPE HERE' => 1);
if (arg(0) == 'node' && is_numeric(arg(1))) {
  $nid = arg(1);
  $node = node_load(array('nid' => $nid));
  $type = $node->type;
  if (isset($types[$type])) {
    $match = TRUE;
  }
}

if (substr($_SERVER["REQUEST_URI"], 0) == "/YOUR NODE HERE")
{ $match = TRUE;}

if (substr($_SERVER["REQUEST_URI"], 0) == "/ANOTHER NODE HERE")
{ $match = TRUE;}

return $match;
?>

My question:
I am using the "Bonus: Summary + full view, which is great to set up a directory.
The problem is that I end up with loads of view pages which of course do not belong to my content type.
How can I have a block which is visible for all nodes of my content type AND on the view pages??
Of course I can add every single view page using the method I included above.. but there must be a shorter way, no?

Many thanks,
Drupalworld

Comments

drupalworld’s picture

Or another to do it, I just realized, without the views would be to have a php for content type AND taxonomy term...
Is this possible?

Many thanks,
Drupalworld

ronan’s picture

if it's not too late to change the urls of your site, and if it makes sense to the info-architecture, you could use pathauto to give all nodes of a given type a similar url and give the relevent views the same url pattern:

for example, say your type is news items, you could make the urls for all the nodes be:

news/TITLE_HERE

and the view (or views) be:

news/all

or similar.

Then show the block only on:

news/*

Not sure if this is what you were asking though.

R
------------------------------------
Gorton Studios - Websites that Work. http://www.gortonstudios.com/
http://www.gortonstudios.com/portfolio/technologies/drupal

------------------------------------
Ronan
Founder - NodeSquirrel - https://www.nodesquirrel.com/
Agency Tools Lead - Pantheon - https://www.pantheon.io/

drupalworld’s picture

Thank you so much... I would have never looked into that direction without your help.
Drupalworld

Anonymous’s picture

What an excelent solution, solved a problem i had been looking at for a while , using the second code example.

But, there is always a but ! How would I impliment a wildcard into this

I have a URL that generates variants on the folowing

mypath/mypath2/search?filter0=test

I tried using the normal syntax for block visibility as follows but without success

mypath/mypath/*

Can anyone suggest a solution?