By GreenSpiderDesign on
Okay, so I found this discussion from 2005 about a patch that would allow a block to only display on a specific node type - http://drupal.org/node/16074 - but does anyone know if this would still work for D6?
I want to add blocks to a specific node type - so this is exactly what I'm looking to do.
Would I need to write a php script to filter this? HELP!! :D
Comments
...
No patch needed... just change the block's Page specific visibility settings to 'Show if the following PHP code returns TRUE', and add this PHP code just below this setting:
This code will display the block for nodes of type blog... change the node type to suit your needs.
SWEET!
Thank you so much roopletheme!!
Yes thanks!
:)
this works great, except for
this works great, except for that I’d like the block to show for nodes of type “blog” AND also on specific pages – in my case www.mysite.com/blog which is a view showing a list of blogs. How can I do both?
Use same logic. if ( arg(1)
Use same logic.
if ( arg(1) == NODE_ID_OF_BLOG)
return TRUE;
COOL! but how the heck do i
COOL!
but how the heck do i find the Node ID of a View? been googling around for that and i keep coming up short. how might i use the same logic, but to check for a URL, rather than NID?
My Bad... I misread that. If
My Bad... I misread that. If its a view, then
Basically any URL check you can use something like this. Hope this helps.
THANKS!!
works perfectly!!!!!