Hi,

I just saw your comments on creating a custom block. I have this unique problem and I am breaking my head over it.
I have a content type say Type A that has a field which will reference another content type Type B. So my structure is
Type B
B Content 1
B Content 2
Type A
A content 1 -> B content1
A content 2 -> B content1
A content 3 -> B content 2 ....

I have used views to create a block that will display all the contents of Type A and display it whenver i see content type B in the right sidebar.
The problem I have is that I am unable to filter it further depending on Content B. Say for example I am viewing content B I want the block to display A content 1 and Acontent 2 but not Acontent 3.
Similarly if I am viewing content B I want the block to display A content 3 and not Acontent 2 or Acontent 1.

At present the solution I have for this is to make a different block for each Content type B and use a filter to specify the content type. But the problem is that i will have to create 1 block for each content in Type B which is not feasible in the long run.

Can this be automated. Can we get the information dynamically and use it? In short I want an argument for the block! is that possible?

If you could point me in the right direction it will be great.
Thanks for the help.

Comments

freedomhonal’s picture

Status: Active » Closed (fixed)

Ok I found out how to add arguments to blocks!!

Add this to the argument handling code and you can use the arguments in the url in the blocks!

if ($type=='block'){
$args[0] = arg(1);
}
return $args;