node view override, calling views with arguments

schimmy - July 28, 2009 - 09:23
Project:Panels
Version:6.x-3.1
Component:Panel nodes
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed
Description

Hi all,

I hope you can help me with my problem. I try to override the node view so that it displays the information about the node and also the summarys of all nodes which are in the same Category. To Categorise the content I use the module Taxonomy.
To achieve this I have done the following: First of all I defined a new content-Type. This is working. Than I build a view that gets a category as argument and displays a List of all nodes that are of my new defined contend-type and also have the given argument as category. This is working as well. Than I started to override the node view. In the first step I just used one region. In this region I displayed the information of my content-type in the way I want. this is working as well. When I click on some content of different type all are displayed the default way, only my new defined content is displayed the way I difined by overriding it's node view.
In the end I tried to change the node view that I already overrode, so that it displays the view that I created. to achieve this I added a new region. In this region i placed some custom content. In the custom content I added the php code to print the view. As a test I first gave a hardcoded parameter and it worked. The php Code to display the view is the following:

<?php
print views_embed_view("anteile_uebersicht", "default","category");
?>

now the only thing left to get it working completely is to pass the category of the actual displayed node to the view, instead of the hardcoded String. The point is: I don't know how to do this.
As far as I know I should be able to reference the node actualy displayed by $node. I guess node has a property taxonomy. none of these variables have some content. I tried to print them out, but nothing gave me an output. Here are the print statements that I used for test-outputs:

<?php
print $term->name;
print
$node->nid;
print
$node->taxonomy;
print
$node;
print
$terms;
print
$node->term;
?>

I used print_r for all of them as well but nothing is printed. What am I doing wrong? how can I pass the category (taxonomy) to my view? Is there a better way to do this, so that I don't have to use custom php code?

I am using Drupal 6.10,
Panels 3 (6.x-3.0-beta2)
Views (6.x-2.3)

I hope you can help me out and give me a few Hints!

#1

yevonsoul - October 21, 2009 - 06:41

subscribed

#2

merlinofchaos - October 21, 2009 - 20:34
Version:6.x-3.0-beta2» 6.x-3.1
Status:active» fixed

The proper way to do this with Panels 3:

Either use the node_view page or edit a page with %node set to a Node: Id argument.

Add your variant. Go to the 'Context' tab of the variant, and add "Term from node" relationship. Select the vocabulary you want.

Go to content page. Add content. Select a view that accepts a taxonomy term argument. Make sure your term from node relationship is selected for the argument.

#3

System Message - November 4, 2009 - 20:40
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.