Dear Eaton,

I´m trying to use insert view with custom node types and a custom node.tpl.php. But i have no success.

My code for part of the tpl is:

<h4 class="colhead"><?php print t($node->field_body_title[0]['view']).'&nbsp;'; ?></h4>
			    							
				 <?php print $node->content['body']['#value'] ?><br> <br> 
					
				 <?php if (count($taxonomy)): ?>
    				<div class="taxonomy"><?php print t(' in ') . $terms ?></div>
 				 <?php endif; ?>
			  </div>

But insert view tags are always shown as plain text. I tryed to solve it like this:
<?php print _insert_view_substitute_tags($node, 'body') ?>

But then it shows all fields of the $node->body instate only the value for the field_body. All the other filters are working only insert view is not.

I think it is because of the funktion insert_view_substitute_tags.

Any Idea

Thanks Dirk

Comments

mlsamuelson’s picture

Hi Dirk,

Correct me if I'm mistaken, but it sounds like you're attempting to apply Insert Views code at the tpl level, rather than as tags entered into the node's form. Am I correct?

All you have to do is key in the tag [view:NameOfView] and that view will appear in the node. There's more info on how to do this in the README.txt file, and in the filter tips in the "input filters" section of the node edit page.

mlsamuelson

designwork’s picture

Hi mlsamuelson,

no i tryed to put the view tag in the node. Just because it is not working with my tpl files i tryed to print the view tag with <?php print _insert_view_substitute_tags($node, 'body') ?>.

But i solved the problem by rewriting the module. The problem was the funktion _insert_view_nodeapi. Now i changed it and it works fine.

Dirk

PS now it will work for any theme with any field CCK you print out in your theme not only with the body variable.

mlsamuelson’s picture

If you'd like to submit your rewrite as a patch, we'd love to review it for potential inclusion in the current module.

mlsamuelson

designwork’s picture

Hi mlsamuelson,

how to submit?

Dirk

mlsamuelson’s picture

You can submit a patch here in this issue thread. Simply attach it as a file.

More info on patches can be found at http://drupal.org/patch .

mlsamuelson

erikhopp’s picture

I'm pretty sure this is the same issue and I provided a patch that is hopefully moving in the right direction: http://drupal.org/node/170921#comment-309074

Erik.

designwork’s picture

Hi erikhop,

yes you are rigth, its the same problem. Thanks for the patch. I had no time to do it.

Dirk

mlsamuelson’s picture

Status: Active » Closed (duplicate)

See http://drupal.org/node/170921#comment-621627

Marking this one as a duplicate.