Hi

When I combine some php code with an insert view, my php code doesn't work. All of the php code, except for the opening <?php tag, is displayed as text.

Glenn

Comments

manoloka’s picture

Yep, I've got the same, it won't read tags at all

manoloka’s picture

I'v rearranged the weight in the input format and didn't sort anything

I'v using this php as the tag <?= $tid ?>

What am I doing wrong?

manoloka’s picture

Hi there,

Am I expecting the wrong behaviour?

When I use [view:taxonomy_term==45] I get what I was expecting but If I use [view:taxonomy_term==<?= $tid ?>] (obviously giving $tid=45) I just get an empty page.

Is this a bug or am I asking too much to this module?

Please a quick answer would be appreciate so I can move on to find what I really need.

Thanks

xtfer’s picture

I'm not sure what variables are available to you through the input filters, but have you tried:

[view:taxonomy_term== print $tid; ]

manoloka’s picture

Yes, I have tried that and didn't work.

Any other suggestions?

Thanks

manoloka’s picture

So, is that the expected behaviour or something isn't working ?

nevets’s picture

There are no predefined variables in the node body. You would need something like (note this only works when displaying a node by its self.)

<?php
if (  $node =  menu_get_object()  )  {
  if ( is_array($node->taxonomy) &&  !empty($node->taxonomy) ) {
     $term = array_shift($node->taxonomy);
     print '[view:taxonomy_term==' . $term->tid .  ']';
  }
}
?>

To work the PHP filter must run before the view inline filter.
It uses the first taxonomy term.

Pasqualle’s picture

Status: Active » Closed (works as designed)

closing all D5 issues