Combined with php doesn't work

glennnz - January 21, 2009 - 10:29
Project:Insert View
Version:5.x-1.0
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:active
Description

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

#1

manoloka - March 13, 2009 - 18:37

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

<?php

?>
tags at all

#2

manoloka - March 19, 2009 - 14:33

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?

#3

manoloka - April 5, 2009 - 10:44

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

#4

xtfer - April 11, 2009 - 04:19

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

[view:taxonomy_term==

<?php
print $tid;
?>
]

#5

manoloka - April 13, 2009 - 09:53

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

Any other suggestions?

Thanks

#6

manoloka - May 7, 2009 - 16:05

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

#7

nevets - May 7, 2009 - 16:15

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.

 
 

Drupal is a registered trademark of Dries Buytaert.