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 |
Jump to:
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
Yep, I've got the same, it won't read
<?php
?>
#2
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
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
I'm not sure what variables are available to you through the input filters, but have you tried:
[view:taxonomy_term==
<?phpprint $tid;
?>
#5
Yes, I have tried that and didn't work.
Any other suggestions?
Thanks
#6
So, is that the expected behaviour or something isn't working ?
#7
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.)
<?phpif ( $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.