Hi there,

I have an page-node and an image-node which shall appear
within two different blocks, like left-sidebar and the other one
in right-sidebar.

How can I manage this? With views? Or is it easier?
I guess I have to "convert" a node into a block to do
so?

Thanks a lot for help!
Cheers,
Soezkan

Comments

ludo1960’s picture

..a php include() in the block

soezkan’s picture

Thanks for replying. But isn't there an "easier" way to do that.
I think I don't want to fiddle around with php.

Any other idea?

ludo1960’s picture

Note sure if there is an easier way, you could use Views to create a view then call that view into your block using your good friend PHP!

soezkan’s picture

But how can I bring some PHP code into a block?

Thanks for more help!

:) soezkan

ludo1960’s picture

..edit/block in admin and select input format then select PHP

yelvington’s picture

There is no need to use PHP to put views into blocks. Views does that.

ludo1960’s picture

..you can expose a view in a block but how do you print it?

hectorplus’s picture

enable the PHP filter module, site building > modules, you need to grant permissions to yourself after enabling it.

if you need to print a view in a block:

<?php
$block = module_invoke('block', 'block', 'view', #);
print $block['content'];
?>

# = the id of the block, say 3

http://www.tecito.com

rogerpfaff’s picture

as noted below. if you use views: create the view, create a block display for the view. put the block in your sidebar in the block configuration.

rogerpfaff’s picture

Is the cck blocks modules what you are looking for? http://drupal.org/project/cck_blocks

soezkan’s picture

Thank you so much for all the replies!

What I actually want to do:
Supposing I have four page-nodes.
All of these nodes shall appear in the content-block.
Assuming a visitor chooses the first page-node from the menu,
then in the right-sitebar an image shall appear.

But the image shall change as the nodes-change, which means:
If somebody chosen node/1 the image green.jpg shall appear
beside, if one chosen node/2 the image called red.jpg shall
appear.

ludo1960’s picture

..You will have to use PHP for block visibility, do a search for block visibilty to help you out with this.

rogerpfaff’s picture

are the images saved in relation to the node? then go ahead with imagefield and cck blocks.

alternatively you can use views and node reference for example. i would try to avoid php in the block code as often as possible.

there are many possible ways to accomplish such a goal without writing a single line of php. :-)