By quotientix on
Hi there,
can somebody please tell me, how to show a block on pages being of a specific content-type?
I'm guessing it has to be something in "Show if the following PHP code returns TRUE (PHP-mode, experts only)."
Many thanks :)
Comments
Module - MultiBlock
There is a new module which might provide a solution: MultiBlock
"Drupal's block module is limited by the fact that a block can only have one instance. Each block has a 1:1 relationship with its region, weight, visibility (and other) settings. This means that it is impossible to have blocks in multiple regions or to have blocks that have different settings on different pages. MultiBlock module solves this problem by allowing you to create multiple Block Instances of already existing blocks. Please read the README for more information."
http://drupal.org/project/multiblock
David Comfort
You are on the right track,
You are on the right track, you want to place something like the following there
Thanks!
Thanks, that's working perfectly fine.
I have another question:
can you please tell me, how to change the php-code so that the block is showing on:
Type Musical
Type Play
View named "Musicals"
View named "Plays"
Many thanks, my php-knowledge is as bad as it gets!
This should help, note the
This should help, note the comment on types
Many thanks, nevets! It's
Many thanks, nevets!
It's working perfectly fine! It would have taken weeks for me to figure it out myself :-D
adding wildcard to URL?
This script works perfectly for me. Thanks. However, I'd like to add a wildcard to one of my paths so that the block will display no matter what argument has been added on to the end.
For example, I have a taxonomy menu that creates paths like this: project/10 and project/11.
I'd like my block to be visible for any path that includes project/*. I also want it to display on my /gallery node.
So, in the second part of the script that checks the path, I've tried the following:
Now the block is visible on the gallery page, but not the project/* page. I've also tried replacing the % with a *, but neither worked. Any suggestions?
Is project/10 are real path
Is project/10 are real path or an alias?
Well, I'm not sure I know the
Well, I'm not sure I know the answer to that. I have the Taxonomy Menu module installed, which lets me create a custom path for my taxonomy terms. So, rather than taxonomy/term/tid, the path to each term id is project/tid.
That sounds like an alias to me, but I'm not completely sure.
How to invert this? Hide block only on certain content types?
Hi, thanks for the code, this is exactly what I want to accomplish...
But what I really want is to show the block always, EXCEPT on a few specific content types and/or URLs.
How would you reverse this code so it returns true on all content types except those you specify?
Thanks!
Reversing my earlier example
Reversing my earlier example so it shows on all but some selected pages negate the return values like this
For those who arrived here from teh Google...
... it's cheaper to use a node that's already built via:
than to use:
This thread solved my issue, though!
Note in this case
Note in this case menu_get_object() also gets the node from node_load() and both cases the node is cached.
Adding to content type and path
This was all incredibly helpful. I have this working on a specific content type but I would also like it to appear on any page with a specific path, such mysite.org/climate-change. So far I am using the following code:
How would I also add the URL alias climate-change?
Thanks again for the help with this!