Here is the scenario:

I have a node content type call project. The user makes this content and publishes it.
Next they make another content type called Pictures.

Both Content types have the exact same Title.

I am trying to display the pictures in the node-project.tpl.php I can get the views block for the pictures to display in the node just fine, but it displays for everything. I want it just to display for the same node title.

The obvious way to do this would to be using taxonomy terms and use the following code:

$node=node_load(arg(1));
if($node){
foreach($node->taxonomy as $term){$terms[]=$term->tid;}
return implode('+',$terms);
}else {return;}

Then each content type would have free tagging taxonomy. I tried this and it works perfectly. However the end user has to fill in the title twice and it could become confusing.
Is there a way I can put in a php argument based on the node title to pull the picture content into the project content since they will both have the same node title?

Comments

WorldFallz’s picture

I'm confused-- why can't you use the "Node: Title" argument with the following code for the block argument handling code:

if (arg(0) == 'node' && is_numeric(arg(1))) {
  $node = node_load(arg(1));
  return $node->title;
} else {
  return FALSE;
}
hankpalan.com’s picture

Well that code worked perfectly.
I don't know my php very well, but I am learning.
Thanks for they help I appreciate it a lot.

I'm getting just that much closer to understanding the arguments and php.

Wedding Videography - www.rusticred.com
Web Presence Management and Design - www.hankpalan.com

WorldFallz’s picture

No worries-- i just thought maybe i was missing some reason you couldn't do it that way.

Views is one of the most powerful and complex modules available-- and argument handling code is incredibly useful. The more you use views and argument handling code the better you'll get at it. I used to have to do research every time i needed to code something there-- now I pretty much can figure it out without looking up anything.

Be patient-- you'll grok it!